Linux-SWAT
Forum Addict!
- Joined
- Feb 13, 2010
- Messages
- 9,189
Hi,
I made a little test program.
This range works for me on a Uno.
I made a little test program.
This range works for me on a Uno.
Code:
// GPL3 license, Linux-SWAT, 2021
// Distributed as is.
// 16 bits, 9600 bauds, start bit low
int serialPin = 8;
short num = 0xa55a;
byte state;
void setup()
{
pinMode(serialPin, OUTPUT);
digitalWrite(serialPin, HIGH);
delay(100);
}
void loop()
{
for (int F=97; F <= 100; F++){ // test range
//delay(500);
digitalWrite(serialPin, LOW); // start bit low
delayMicroseconds(F);
for (int i=0; i <= 15; i++){
state = bitRead(num, i);
digitalWrite(serialPin, state);
delayMicroseconds(F);
}
digitalWrite(serialPin, HIGH); // end bit high
delayMicroseconds(F);
}
}