Update .gitignore, add base sketches
This commit is contained in:
parent
5f44fbe3b9
commit
513a79a1c2
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
|||||||
'libraries'
|
libraries
|
4
Sketches/.vscode/arduino.json
vendored
Normal file
4
Sketches/.vscode/arduino.json
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"board": "arduino:avr:uno",
|
||||||
|
"port": "COM7"
|
||||||
|
}
|
16
Sketches/.vscode/c_cpp_properties.json
vendored
Normal file
16
Sketches/.vscode/c_cpp_properties.json
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Win32",
|
||||||
|
"includePath": [
|
||||||
|
"C:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\**",
|
||||||
|
"C:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.6.21\\**"
|
||||||
|
],
|
||||||
|
"forcedInclude": [
|
||||||
|
"C:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.6.21\\cores\\arduino\\Arduino.h"
|
||||||
|
],
|
||||||
|
"intelliSenseMode": "msvc-x64"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": 4
|
||||||
|
}
|
38
Sketches/sketch_sep13a/sketch_sep13a.ino
Normal file
38
Sketches/sketch_sep13a/sketch_sep13a.ino
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
Blink
|
||||||
|
|
||||||
|
Turns an LED on for one second, then off for one second, repeatedly.
|
||||||
|
|
||||||
|
Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
|
||||||
|
it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
|
||||||
|
the correct LED pin independent of which board is used.
|
||||||
|
If you want to know what pin the on-board LED is connected to on your Arduino
|
||||||
|
model, check the Technical Specs of your board at:
|
||||||
|
https://www.arduino.cc/en/Main/Products
|
||||||
|
|
||||||
|
modified 8 May 2014
|
||||||
|
by Scott Fitzgerald
|
||||||
|
modified 2 Sep 2016
|
||||||
|
by Arturo Guadalupi
|
||||||
|
modified 8 Sep 2016
|
||||||
|
by Colby Newman
|
||||||
|
|
||||||
|
This example code is in the public domain.
|
||||||
|
|
||||||
|
http://www.arduino.cc/en/Tutorial/Blink
|
||||||
|
*/
|
||||||
|
|
||||||
|
// the setup function runs once when you press reset or power the board
|
||||||
|
void setup() {
|
||||||
|
// initialize digital pin LED_BUILTIN as an output.
|
||||||
|
pinMode(LED_BUILTIN, OUTPUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
// the loop function runs over and over again forever
|
||||||
|
void loop() {
|
||||||
|
int rnd = random(100, 5000);
|
||||||
|
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
|
||||||
|
delay(rnd); // wait for a second
|
||||||
|
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
|
||||||
|
delay(rnd); // wait for a second
|
||||||
|
}
|
4
Sketches/sketch_sep20a/.vscode/arduino.json
vendored
Normal file
4
Sketches/sketch_sep20a/.vscode/arduino.json
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"port": "COM7",
|
||||||
|
"board": "arduino:avr:uno"
|
||||||
|
}
|
16
Sketches/sketch_sep20a/.vscode/c_cpp_properties.json
vendored
Normal file
16
Sketches/sketch_sep20a/.vscode/c_cpp_properties.json
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Win32",
|
||||||
|
"includePath": [
|
||||||
|
"C:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\**",
|
||||||
|
"C:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.6.21\\**"
|
||||||
|
],
|
||||||
|
"forcedInclude": [
|
||||||
|
"C:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.6.21\\cores\\arduino\\Arduino.h"
|
||||||
|
],
|
||||||
|
"intelliSenseMode": "msvc-x64"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": 4
|
||||||
|
}
|
45
Sketches/sketch_sep20a/sketch_sep20a.ino
Normal file
45
Sketches/sketch_sep20a/sketch_sep20a.ino
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/**
|
||||||
|
* Version 1
|
||||||
|
*/
|
||||||
|
float numOne = 1337;
|
||||||
|
float numTwo = 256;
|
||||||
|
float numThree = 512;
|
||||||
|
float numFour = 1024;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Version 2
|
||||||
|
*/
|
||||||
|
float myNumbers[4] = {1337, 256, 512, 1024};
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(9600);
|
||||||
|
// Version 1
|
||||||
|
float sumOne = numOne + numTwo + numThree + numFour;
|
||||||
|
float dividedOne = sumOne / 4;
|
||||||
|
|
||||||
|
Serial.print("Version 1: ");
|
||||||
|
Serial.print(dividedOne);
|
||||||
|
Serial.println();
|
||||||
|
|
||||||
|
// Version 2
|
||||||
|
// Divide length of array by length of a single float byte,
|
||||||
|
// to get the "correct count" (how many single `float`s exist in the array)
|
||||||
|
// of myNumbers in the relevant array.
|
||||||
|
float listLength = sizeof(myNumbers) / sizeof(float);
|
||||||
|
float sumTwo = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < listLength; i++)
|
||||||
|
{
|
||||||
|
sumTwo = sumTwo + myNumbers[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
float dividedTwo = sumTwo / listLength;
|
||||||
|
|
||||||
|
Serial.print("Version 2: ");
|
||||||
|
Serial.print((dividedTwo));
|
||||||
|
Serial.println();
|
||||||
|
|
||||||
|
Serial.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {}
|
23
Sketches/sketch_sep20b/sketch_sep20b.ino
Normal file
23
Sketches/sketch_sep20b/sketch_sep20b.ino
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
void prnt(int largest, int smallest) {
|
||||||
|
Serial.print(largest);
|
||||||
|
Serial.print(" is larger than ");
|
||||||
|
Serial.print(smallest);
|
||||||
|
Serial.println();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(9600);
|
||||||
|
|
||||||
|
int numOne = 6812;
|
||||||
|
int numTwo = 3333;
|
||||||
|
|
||||||
|
if (numOne > numTwo) {
|
||||||
|
prnt(numOne, numTwo);
|
||||||
|
} else {
|
||||||
|
prnt(numTwo, numOne);
|
||||||
|
}
|
||||||
|
|
||||||
|
Serial.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {}
|
Loading…
Reference in New Issue
Block a user