-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
82 additions
and
10 deletions.
There are no files selected for viewing
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
4 changes: 4 additions & 0 deletions
4
exp0-blinking-led/notes.org → exp1-blinking-led/exp1-notes.org
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
* General notes | ||
- Some pushbuttons are a little sticky; if you don't firmly press down on them, they can get stuck on and make you think | ||
your circuit or your code is wrong. | ||
- This exp is basically 2 circuits. Build each in turn, starting with the LED circuit from exp1. | ||
|
||
* Extensions | ||
- Can you make the LED turn on when the button is not pressed? | ||
- Can you make it take 2 button presses to turn on the LED? | ||
- Can you make 1 LED turn on when the button is being pressed, and another when it is not pressed? |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* @file pushbutton-led.ino | ||
* | ||
* This is free and unencumbered software released into the public domain. | ||
* Anyone is free to copy, modify, publish, use, compile, sell, or | ||
* distribute this software, either in source code form or as a compiled | ||
* binary, for any purpose, commercial or non-commercial, and by any | ||
* means. | ||
* | ||
* In jurisdictions that recognize copyright laws, the author or authors | ||
* of this software dedicate any and all copyright interest in the | ||
* software to the public domain. We make this dedication for the benefit | ||
* of the public at large and to the detriment of our heirs and | ||
* successors. We intend this dedication to be an overt act of | ||
* relinquishment in perpetuity of all present and future rights to this | ||
* software under copyright law. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
* OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* For more information, please refer to <http://unlicense.org/> | ||
*/ | ||
|
||
/* The pin # of the pushbutton */ | ||
const int BTN_PIN = 2; | ||
|
||
/* The pin # of the LED */ | ||
const int LED_PIN1 = 12; | ||
const int LED_PIN2 = 8; | ||
|
||
/* 1-time setup code that runs during initialization. */ | ||
void setup(void) { | ||
pinMode(LED_PIN1, OUTPUT); | ||
pinMode(LED_PIN2, OUTPUT); | ||
pinMode(BTN_PIN, INPUT); | ||
} | ||
|
||
/* Main code, which will run forever. */ | ||
void loop(void) { | ||
int btn_state = digitalRead(BTN_PIN); | ||
if (HIGH == btn_state) { | ||
digitalWrite(LED_PIN1, HIGH); | ||
digitalWrite(LED_PIN2, LOW); | ||
} else { | ||
digitalWrite(LED_PIN1, LOW); | ||
digitalWrite(LED_PIN2, HIGH); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
* Introduction | ||
- Should probably walk everyone through the very first blinking LED project, so they see how to use the IDE, program the | ||
board, and do a bit of programming. If things go well, this might also be a good idea to do periodically, so if new | ||
people come to the classes, they can get a nice intro without feeling lost. | ||
|
||
* Construction | ||
- How much of circuit diagram stuff should I go into? Will it help? Basic stuff like voltage, current, resistance, are | ||
necessary at least. | ||
|
||
* Safety | ||
- Don't worry about shorting/breaking stuff. Try not to, but some of that is part of the learning experience. | ||
- If you aren't sure if something will short out, ask! |