User:Zalán Szakács/grad prototyping: Difference between revisions
No edit summary |
No edit summary |
||
Line 19: | Line 19: | ||
[https://www.digikey.com/en/resources/conversion-calculators/conversion-calculator-resistor-color-code-4-band conversion calculator resistor color code] | [https://www.digikey.com/en/resources/conversion-calculators/conversion-calculator-resistor-color-code-4-band conversion calculator resistor color code] | ||
== Light-Emitting Diodes (LEDs) == | |||
<gallery class="center" widths=692px heights=405px> | |||
File:51f1c87ace395fea20000004.png| | |||
</gallery> | |||
<br> | |||
<gallery class="center" widths=692px heights=405px> | |||
File:51f1d3a2ce395fd720000008.jpg| | |||
</gallery> | |||
<br> | |||
==How to use Arduino? == | ==How to use Arduino? == | ||
Line 131: | Line 144: | ||
<gallery class="center" widths=692px heights=405px> | <gallery class="center" widths=692px heights=405px> | ||
File:42928861 293565571474958 6996520953752584192 n.jpg| | File:42928861 293565571474958 6996520953752584192 n.jpg| | ||
</gallery> | </gallery> | ||
<br> | <br> |
Revision as of 10:55, 2 October 2018
P R O T O T Y P I N G
What is a Circuit?
What are Resistors?
conversion calculator resistor color code
Light-Emitting Diodes (LEDs)
How to use Arduino?
1. Arduino Script
* * Zalan's first Program */ int ledPin = 13; void setup() { //initialize pins as outputs pinMode(ledPin, OUTPUT); } void loop() { digitalWrite(ledPin, HIGH); delay(1000); digitalWrite(ledPin, LOW); delay(1000); }
2. Arduino Script
int LED = 12; int BUTTON = 4; void setup() { pinMode(LED,OUTPUT); pinMode(BUTTON,INPUT); } void loop() { if(digitalRead(BUTTON) == HIGH) { digitalWrite(LED,HIGH); }else { digitalWrite(LED,LOW); } }
3. Arduino Script
int switchPin = 8; int ledPin = 13; boolean lastButton = LOW; boolean currentButton = LOW; boolean ledOn = false; void setup() { pinMode(switchPin, INPUT); pinMode(ledPin, OUTPUT); } boolean debounce(boolean last) { boolean current = digitalRead(switchPin); if (last != current) { delay(5); current = digitalRead(switchPin); } return current; } void loop() { currentButton = debounce(lastButton); if (lastButton == LOW && currentButton == HIGH) { ledOn -= !ledOn; } lastButton = currentButton; digitalWrite(ledPin, ledOn); }