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
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); |
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
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); |
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
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); |
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 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 */ |
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
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 |
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
class StreamReader { | |
let encoding : UInt | |
let chunkSize : Int | |
var fileHandle : NSFileHandle! | |
let buffer : NSMutableData! | |
let delimData : NSData! | |
var atEof : Bool = false |
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
char inData[20]; // Allocate some space for the string | |
char inChar=-1; // Where to store the character read | |
byte index = 0; // Index into array; where to store the character | |
void setup() { | |
Serial.begin(9600); | |
Serial.write("Power On"); | |
} | |
char Comp(char* This) { |
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
// | |
// HTTP.swift | |
// TableTest2 | |
// | |
// Created by Gazolla on 22/05/16. | |
// Copyright © 2016 Gazolla. All rights reserved. | |
// | |
import Foundation | |
import UIKit |
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
func quicksort<T:Comparable>(list:[T])->[T]{ | |
if list.isEmpty { | |
return list | |
} | |
let pivot = list[list.count/2] | |
let equal = list.filter{ $0 == pivot } | |
let less = list.filter{ $0 < pivot } | |
let greater = list.filter{ $0 > pivot } | |
return quicksort(less) + equal + quicksort(greater) | |
} |
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
let sentence = "Hello, My name is Bob" | |
let result = sentence.characters.reversed().map { String($0) }.joined(separator:"") | |
print(result) |
OlderNewer