Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PJON_test_receiver
#include <PJON.h>
// <Strategy name> bus(selected device id)
//PJON<SoftwareBitBang> bus(44);
PJON<OverSampling> bus(44);
void setup() {
pinModeFast(13, OUTPUT);
digitalWriteFast(13, LOW); // Initialize LED 13 to be off
bus.set_pins(8, 7);
bus.set_receiver(receiver_function);
bus.begin();
bus.set_communication_mode(HALF_DUPLEX);
//bus.include_sender_info(false);
//bus.set_acknowledge(true);
//bus.set_packet_auto_deletion(true);
//bus.set_router(false);
Serial.begin(9600);
};
void receiver_function(uint8_t *payload, uint8_t length, const PacketInfo &packet_info) {
if(payload[0] == 'B') {
//Serial.println("BLINK");
digitalWriteFast(13, !digitalRead(13));
//delay(10);
//digitalWrite(13, LOW);
//bus.reply("C1", 2);
//bus.update();
}
}
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