Don't ad-block us - support your favorite websites. We have safe, unobstrusive, robotics related ads that you actually want to see - see here for more.
0 Members and 1 Guest are viewing this topic.
since it's TX only.
AVR compatible Software Serial library that uses no hardware resources, other then flipping the pin (obviously).
You could probably grab the Arduino SoftwareSerial (polled)
WebbotLib lets you only have Tx
No worries, I whipped one out that works ok. Been a little refreshing coding from scratch.
#define baud 4800#define bit_delay 1000000/baud
//write out a byte as software emulated Uartvoid serialWrite(byte bite){digitalWrite(TXPIN, LOW); //signal start bit_delay_us(bit_delay); for (byte mask = 0x01; mask; mask <<= 1) { if (bite & mask){ // choose bit digitalWrite(TXPIN,HIGH); // send 1 } else{ digitalWrite(TXPIN,LOW); // send 0 } _delay_us(bit_delay); } digitalWrite(TXPIN, HIGH); //signal end bit _delay_us(bit_delay);}
string_len = sprintf(string, "Volts: %u.%u Freq %lu.%lu Amps1: %u.%u ", max_volts/10, max_volts%10, (10000000/freq)/10, (10000000/freq)%10, max_amps1/10, max_amps1%10); for(int i = 0; i< string_len; i++) serialWrite(string[i]);
while (delta Clock < bit delay) ;