This file contains hidden or 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
| typedef struct { | |
| uint8_t device; | |
| uint8_t command; | |
| uint32_t value; | |
| uint64_t serial; | |
| uint8_t ack; | |
| } Command; | |
| void SenderApplication::didReceiveGoodPacket(SerialPacket *p) { | |
| Serial.println("Got good packet!"); |
This file contains hidden or 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
| // pin defines | |
| #define A 12 | |
| #define B 11 | |
| #define C 10 | |
| #define D 9 | |
| #define E 8 | |
| #define PIN_COUNT 5 | |
| #define PIN_CONFIG 0 |
This file contains hidden or 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
| String printBigBinary( uint32_t n, int spacing ) { | |
| int bitPosition = sizeof(n) * 8 - 1; | |
| String bits = ""; | |
| while (bitPosition >= 0) { | |
| bits += (n & (1UL<<bitPosition)) == (1UL<<bitPosition) ? "1" : "0"; | |
| if (bitPosition % spacing == 0) { | |
| bits += " "; | |
| } | |
| bitPosition--; | |
| } |
This file contains hidden or 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
| /* | |
| * Chase16LEDs.ino | |
| * Description: Quick, down-n-dirty demo of Charlieplexing LEDs on an Arduino | |
| * http://StuffAndyMakes.com | |
| */ | |
| #define A 12 | |
| #define B 11 | |
| #define C 10 | |
| #define D 9 |
This file contains hidden or 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
| #import <Foundation/Foundation.h> | |
| #import <CoreLocation/CoreLocation.h> | |
| @interface iBeaconSample : NSObject <CLLocationManagerDelegate> | |
| @property (strong, nonatomic) CLBeaconRegion *beaconRegion; | |
| @property (strong, nonatomic) CLLocationManager *locationManager; | |
| - (void)initRegion; |
This file contains hidden or 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
| #import "iBeaconSample.h" | |
| @implementation iBeaconSample | |
| // your other code goes here, maybe... | |
| - (void)initRegion { | |
| // Set a proximityUUID | |
| // On a Mac in the Terminal, you can use the uuidgen command to get a UUID |
This file contains hidden or 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 <Servo.h> | |
| #define SERVO_PIN 9 | |
| #define SPEED_POT 14 | |
| Servo fitBitShaker; | |
| void setup() { | |
| fitBitShaker.attach( SERVO_PIN ); | |
| pinMode( SPEED_POT, INPUT ); |
This file contains hidden or 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
| device.on( "lightChanged", function( json ) { | |
| // Set URL to your web service | |
| local url = "http://somedomain.com/api/for/ipotti"; | |
| // Set Content-Type header to json | |
| local headers = { "Content-Type": "application/json" }; | |
| // encode data and log | |
| local body = http.jsonencode( json ); |
This file contains hidden or 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
| // iPotti Number 2 - read value on ADC (ambient light sensor) to see if potti is in use | |
| const SLEEP_DURATION = 5; | |
| // nextReport counts up to FORCE_REPORT_COUNT and reports to server regardless of sensor reading | |
| // to le the server know the device is still alive, then counter resets and starts again | |
| const FORCE_REPORT_COUNT = 13; // about every two minutes | |
| const LIGHT_CHANGE_THRESHOLD = 2000; | |
| function readLighting() { | |
| local adcValue = hardware.pin9.read(); |
This file contains hidden or 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
| #define A 12 | |
| #define B 11 | |
| #define C 10 | |
| #define D 9 | |
| #define LED_COUNT 12 | |
| #define DDR_BYTE 0 | |
| #define PORT_BYTE 1 | |
| byte matrix[LED_COUNT][2] = { |