Nov-05-2018, 01:43 AM
Why would you need Putty? Don't they communicate fine without?
Arduino Sketch:
Arduino Sketch:
const int ledPin = 13 void setup() { pinMode(ledPin, OUTPUT); Serial.begin(9600); } void loop() { Serial.println("Hello Pi"); if (Serial.available()) { flash(Serial.read() - '0'); } delay(1000); } void flash(int n) { for (int i = 0; i < n; i++) { digitalWrite(ledPin, HIGH); delay(100); digitalWrite(ledPin, LOW); delay(100)Raspberry Code:
import serial ser = serial.Serial('/dev/ttyACM0', 9600) while True: print(ser.readline())And to send from Raspberry to Arduino:
ser.write('5'.encode())I would think that there must be tons of people out there who are pulling sensor data from an Arduino via a Pi, so I was just interested in their approach.