Skip to content

Instantly share code, notes, and snippets.

@bitdivision
Last active August 29, 2015 14:07
Show Gist options
  • Save bitdivision/99312b9eaa814710b66a to your computer and use it in GitHub Desktop.
Save bitdivision/99312b9eaa814710b66a to your computer and use it in GitHub Desktop.
Scripts to accompany Zoetrope Blog Post
/**
* A quick example arduino application to test some functions of the library
*/
#include "lencarta_ultrapro.h"
lencarta_ultrapro strobes(9,10);
byte strobeLeft[2] = {2,4};
void setup()
{
Serial.begin(57600);
strobes.begin();
}
void loop()
{
strobes.flashPower(strobeLeft,30);
delay(1000);
strobes.lamp(1,3,LENC_LAMP_ON);
delay(1000);
strobes.sound(1,3,true);
delay(1000);
strobes.slaveMode(1,3,true);
delay(1000);
if(strobes.fireFlash(strobeLeft))
Serial.print("Fired strobe");
if (strobes.test(1,3)) {
Serial.print("Strobe exists");
}
delay(10000);
}
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
// Hardware configuration: Set up nRF24L01 radio on SPI bus plus pins 9 & 10 for CE and CSn
RF24 radio(9,10);
uint64_t addresses[] = {0x5544332200LL,0x5544332201LL};
void setup() {
Serial.begin(57600);
printf_begin();
// Setup and configure rf radio
radio.begin();
radio.setDataRate(RF24_250KBPS);
radio.setChannel(0x28);
radio.setAutoAck(true);
radio.setPayloadSize(10);
radio.openReadingPipe(0,addresses[1]);
radio.openReadingPipe(1,addresses[0]);
radio.startListening(); // Start listening
radio.printDetails(); // Dump the configuration of the rf unit for debugging
}
void loop(void){
if(radio.available()){
byte data[10] = {0};
printf("Packet Available\r\n");
while(radio.available()) {
radio.read( &data, 10 );
printf("Packet 0x%02x", data[9]);
for (int i=8;i>=0;i--) {
printf("%02x",data[i]);
}
printf("\n\r");
}
}
}
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
// Hardware configuration: Set up nRF24L01 radio on SPI bus plus pins 9 & 10 for CE and CSn
RF24 radio(9,10);
uint64_t addresses[] = {0x5544332200LL};
void setup() {
Serial.begin(57600);
printf_begin();
// Setup and configure rf radio
radio.begin();
radio.setChannel(0x26);
radio.openReadingPipe(0,addresses[1]);
radio.startListening(); // Start listening
radio.printDetails(); // Dump the configuration of the rf unit for debugging
}
void loop(void){
if(radio.available()){
byte data[32] = {0};
printf("Packet Available\r\n");
while(radio.available()) {
radio.read( &data, 32 );
printf("Packet 0x%02x", data[31]);
for (int i=30;i>=0;i--) {
printf("%02x",data[i]);
}
printf("\n\r");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment