uwezi

Untitled

Oct 22nd, 2020
781
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <SoftwareSerial.h>
  2.  
  3. const byte rxPin = 2;
  4. const byte txPin = 3;
  5.  
  6. // set up a new serial object
  7. SoftwareSerial mySerial (rxPin, txPin);
  8.  
  9. void setup()
  10. {
  11.   Serial.begin(115200);
  12.   pinMode(rxPin, INPUT);
  13.   pinMode(txPin, OUTPUT);
  14.   mySerial.begin(9600);
  15.  
  16. }
  17.  
  18.   uint8_t count=0x98;
  19.  
  20. void loop()
  21. {
  22.   int16_t c;
  23.   Serial.println(count,HEX); // skicka till serial monitor
  24.  
  25.   // skicka till displayen
  26.   mySerial.print("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
  27.   mySerial.print(char(count));
  28.  
  29.   do
  30.   {
  31.     c = mySerial.read();
  32.     delay(100);
  33.   }
  34.   while (c != 0x40); // 0x40 kommer tillbaka när man släpper en knapp
  35.  
  36.   count++;
  37. }
RAW Paste Data