Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define BAUD 115200
- String StringArray[] = {"C","C#","D","D#","E","F","F#","G","G#","A","A#","B"};
- void setup() {
- // put your setup code here, to run once:
- Serial.begin(BAUD);
- //send a character A to tell processing we are ready
- Serial.println("A");
- }
- void loop() {
- // put your main code here, to run repeatedly:
- }
- //this function reads 3 integer values direcly behind each other, and expects a start character in front of it
- //input should be A123,234,456\r\n
- void serialEvent() {
- while (Serial.available() > 0) {
- char startChar = Serial.read();
- if (startChar == 'A') {
- //when the start char has been received and read read the 3 integers:
- int val = Serial.parseInt();
- Serial.println(val);
- Serial.println(StringArray[val]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement