Created
April 21, 2017 21:37
-
-
Save Girgitt/f5b1d2d92d3e734f5d94ff38584d2051 to your computer and use it in GitHub Desktop.
PJON WINX86 platform arduino code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <PJON.h> | |
// <Strategy name> bus(selected device id) | |
PJON<ThroughSerial> bus(44); | |
void setup() { | |
pinMode(13, OUTPUT); | |
digitalWrite(13, LOW); // Initialize LED 13 to be off | |
Serial.begin(115200); | |
bus.strategy.set_serial(&Serial); | |
bus.begin(); | |
bus.set_receiver(receiver_function); | |
bus.set_synchronous_acknowledge(true); | |
bus.send_repeatedly(45, "ABC test", 8, 1000000); | |
}; | |
void receiver_function( | |
uint8_t *payload, | |
uint16_t length, | |
const PJON_Packet_Info &packet_info | |
) { | |
if(payload[0] == 'B') { | |
digitalWrite(13, HIGH); | |
delay(5); | |
digitalWrite(13, LOW); | |
} | |
} | |
void loop() { | |
bus.update(); | |
bus.receive(1000); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment