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
#define LED 8 | |
#define dot_duration 250 | |
#define dash_duration dot_duration * 3 | |
#define pause_duration dot_duration | |
#define letter_pause dot_duration * 3 | |
#define word_pause dot_duration * 7 | |
void setup() { | |
pinMode(LED, OUTPUT); | |
Serial.begin(9600); |
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
void setup() { | |
// put your setup code here, to run once: | |
Serial.begin(9600); | |
// put this here so that each time I restart with button press I have a line feed gap so I can easily compare with prior results | |
Serial.println(); | |
randomSeed(analogRead(0)); // supposed to make sure random simulates (pseudo random) a random number. | |
// uncomment for mini project 1 | |
ten_random_numbers(); |
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
byte BUTTON_PIN = 7; | |
byte LED_PIN = 6; | |
byte buttonState = 0; | |
void setup() { | |
// put your setup code here, to run once: | |
pinMode(BUTTON_PIN, INPUT); | |
pinMode(LED_PIN, OUTPUT); | |
Serial.begin(9600); |
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
byte BUTTON_PIN = 7; | |
byte LED_PIN = 6; | |
byte buttonState = 0; | |
void setup() { | |
// put your setup code here, to run once: | |
pinMode(BUTTON_PIN, INPUT); | |
pinMode(LED_PIN, OUTPUT); | |
} |
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
byte BUTTON_PIN = 7; | |
byte LED_PIN = 6; | |
byte buttonState = 0; | |
void setup() { | |
// put your setup code here, to run once: | |
pinMode(BUTTON_PIN, INPUT); | |
pinMode(LED_PIN, OUTPUT); | |
Serial.begin(9600); | |
} |
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
init(name: String, address: String, coordinate: CLLocationCoordinate2D, averageRating: Double, numberOfReviews: Int, postingUserID: String, documentID: String) { | |
self.name = name | |
self.address = address | |
self.coordinate = coordinate | |
self.averageRating = averageRating | |
self.numberOfReviews = numberOfReviews | |
self.postingUserID = postingUserID | |
self.documentID = documentID | |
} | |
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
var favoriteFoods = ["Pizza", "Apple Pie", "Sushi", "Bacon"] | |
let aToZFoods = favoriteFoods.sorted() | |
print(aToZFoods) // sorted array | |
print(favoriteFoods) // unchanged original | |
print("") | |
// .sorted() is the same as .sorted(by: <) | |
let alphabetizedFoods = favoriteFoods.sorted(by: <) | |
print(alphabetizedFoods) // sorted array |
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
struct City { | |
var name: String | |
var rainyDays: Int | |
var rainTotal: Double | |
} | |
var cities: [City] = [] | |
cities.append(City(name: "Seattle", rainyDays: 149, rainTotal: 37.7)) | |
cities.append(City(name: "Phoenix", rainyDays: 30, rainTotal: 8.2)) | |
cities.append(City(name: "Chicago", rainyDays: 124, rainTotal: 36.9)) | |
cities.append(City(name: "Boston", rainyDays: 126, rainTotal: 43.8)) |
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
void setup() { | |
// put your setup code here, to run once: | |
pinMode(7, OUTPUT); | |
} | |
void loop() { | |
// put your main code here, to run repeatedly: | |
// analogRead has possible values from 0...1023 | |
int potValue = analogRead(A0); |
OlderNewer