Skip to content

Instantly share code, notes, and snippets.

View gazolla's full-sized avatar

Sebastiao Gazolla Jr gazolla

View GitHub Profile
@gazolla
gazolla / gist:76835584c7205218c8f6
Created December 27, 2014 02:47
Auto Layout - how to follow superview
NSDictionary* views = @{@"collectionView": self.collection};
NSArray* sHorizontal = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|[collectionView]|"
options:0
metrics:nil
views:views];
NSArray* sVertical = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[collectionView]|"
options:0
@gazolla
gazolla / gist:7a04a433902ff6c7e55b
Created December 26, 2014 00:34
Arduino Multi function shield - Read pot and display value on display
/* Define shift register pins used for seven segment display */
#define LATCH_DIO 4
#define CLK_DIO 7
#define DATA_DIO 8
#define Pot1 0
/* Segment byte maps for numbers 0 to 9 */
const byte SEGMENT_MAP[] = {0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0X80,0X90};
/* Byte maps to select digit 1 to 4 */
@gazolla
gazolla / Potentiometer and led
Last active August 29, 2015 14:12
Arduino Multi function shield - Potentiometer and led
const byte LED[] = {13,12,11,10};
#define Pot1 0
void setup()
{
Serial.begin(9600);
// initialize the digital pin as an output.
/* Set each pin to outputs */
pinMode(LED[0], OUTPUT);
pinMode(LED[1], OUTPUT);
@gazolla
gazolla / Switches
Created December 26, 2014 00:29
Arduino Multi function shield - Switches example
const byte LED[] = {13,12,11,10};
#define BUTTON1 A1
#define BUTTON2 A2
void setup()
{
// initialize the digital pin as an output.
/* Set each pin to outputs */
pinMode(LED[0], OUTPUT);
@gazolla
gazolla / All LEDS blinking
Created December 26, 2014 00:27
Arduino Multi function shield
int led1 = 13;
int led2 = 12;
int led3 = 11;
int led4 = 10;
void setup()
{
// initialize the digital pin as an output.
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);