Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Test program for the Python code at https://pastebin.com/dxCjCSn7
- // by Ido Gendel, 2020
- // Upload this to an Arduino Uno, close the IDE,
- // and connect to the arduino's COM PORT using the Python program.
- // If everything works it will blink slowly,
- // otherwise it will blink fast.
- void setup() {
- pinMode(13, OUTPUT);
- Serial.begin(115200);
- }
- uint8_t LEDState = 0;
- void loop() {
- uint8_t x;
- int16_t y;
- x = random(256);
- Serial.write(x);
- digitalWrite(13, LEDState);
- delay(100);
- y = Serial.read();
- x += 1;
- delay((y != -1) && (uint8_t(y) == x) ? 900 : 0);
- LEDState = 1 - LEDState;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement