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 "Arduino.h" | |
#define data 8 | |
#define clk 9 | |
#define oe 7 | |
#define rst 6 | |
void pulseClock() { | |
digitalWrite(clk, HIGH); | |
digitalWrite(clk, LOW); |
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 "mbed.h" | |
DigitalOut data(PTB9); | |
DigitalOut clk(PTB8); | |
DigitalOut oe(PTB10); | |
DigitalOut rst(PTB11); | |
Serial out(PTA2, PTA1); |
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
// CRC-8 - based on the CRC8 formulas by Dallas/Maxim | |
// code released under the therms of the GNU GPL 3.0 license | |
// Found at: http://www.leonardomiliani.com/en/2013/un-semplice-crc8-per-arduino/ | |
uint8_t SerialPacket::_crc8(const uint8_t *data, uint8_t len) { | |
uint8_t crc = 0x00; | |
while (len--) { | |
uint8_t extract = *data++; | |
for (uint8_t tempI = 8; tempI; tempI--) { | |
uint8_t sum = (crc ^ extract) & 0x01; | |
crc >>= 1; |
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
// found at https://learn.adafruit.com/memories-of-an-arduino/measuring-free-memory | |
int freeRam () { | |
extern int __heap_start, *__brkval; | |
int v; | |
return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval); | |
} |
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
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 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 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 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 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 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; |
NewerOlder