SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions about processor boards have here!
User avatar
By olseer
#247770
I am currently using an Arduino Uno in my R2-D2 (we were there at the Corporate office in August). I am looking to decrease the form factor. I will be running a very simple script, where I receive a serial command and then need to send out a serial command via another pin set. Below is an example of the script. I need to power with 5 V power, either through a terminal block or pin set (Not USB).



What would be a good, smaller Arduino board that would satisfy these requirements? I will need 4 of them.



const int rxPin = 2; // Define Rx pin

const int txPin = 3; // Define Tx pin



void setup() {

Serial.begin(9600); // Initialize serial communication at 9600 baud

Serial1.begin(9600); // Initialize Serial1 communication at 9600 baud

}



void loop() {

if (Serial.available() > 0) { // Check if data is available to read

char incomingChar = Serial.read(); // Read the incoming byte



// Send the corresponding second command based on the first command received

switch(incomingChar) {

case '0':

Serial1.println("0xA7,0x00");

break;

case '1':

Serial1.println("0xA7,0x01");

break;

case '2':

Serial1.println("0xA7,0x02");

break;

case '3':

Serial1.println("0xA7,0x03");

break;

case '4':

Serial1.println("0xA7,0x04");

break;

case '5':

Serial1.println("0xA7,0x05");

break;

case '6':

Serial1.println("0xA7,0x06");

break;

case '7':

Serial1.println("0xA7,0x07");

break;

case '8':

Serial1.println("0xA7,0x08");

break;

case '9':

Serial1.println("0xA7,0x09");

break;

case 'A':

Serial1.println("0xA7,0x0A");

break;

case 'B':

Serial1.println("0xA7,0x0B");

break;

case 'C':

Serial1.println("0xA7,0x0C");

break;

case 'D':

Serial1.println("0xA7,0x0D");

break;

case 'E':

Serial1.println("0xA7,0x0E");

break;

case 'F':

Serial1.println("0xA7,0x0F");

break;

default:

// Do nothing if an invalid command is received

break;

}



// Wait a short delay to avoid sending too rapidly

delay(100);

}

}
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum