Skip to content

Instantly share code, notes, and snippets.

@jbobrow
Created April 19, 2019 01:54
Show Gist options
  • Save jbobrow/fac9f3199c3edbf95d0f9749ae33a113 to your computer and use it in GitHub Desktop.
Save jbobrow/fac9f3199c3edbf95d0f9749ae33a113 to your computer and use it in GitHub Desktop.
Sends on all faces, packets and broadcast
/*
Basic Blinks Sender
-------------------
The Blinks Sender will:
1. Broadcast the number of the face on each face
2. When button pressed, send a Packet with a secret message
by Jonathan Bobrow, Move38
04.18.2019
*/
void setup() {
// put your setup code here, to run once:
}
void loop() {
/*
Broadcast face values on faces
and show colors on each face
*/
FOREACH_FACE(f) {
setValueSentOnFace(f, f);
setColorOnFace(makeColorHSB(f * 42, 255, 255), f);
}
/*
Force send packet when button pressed
*/
if (buttonPressed()) {
char packet[] = "hello world!";
FOREACH_FACE(f) {
sendPacketOnFace(f, (byte *) packet, sizeof(packet));
}
setColor(WHITE);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment