際際滷

際際滷Share a Scribd company logo
ARDUINO
Arduino Starter
Workshop
旅旅略了侶 裡凌
留僚留粒旅留虜凌了凌 律流凌
旅溜僚侶 マ留
留流 溜虜凌
IEEE NTUA SB
Arduino Starter
IEEE NTUA SB
稽旅留粒粒流 凌 micro-controllers
稽了了侶了竜溜隆留侶 侶了竜虜凌僚旅虜ホ 竜留ホ
稽了了侶了竜溜隆留侶 侶了竜虜凌僚旅虜ホ 竜留ホ 亮竜 粒留亮亮留
Arduino Starter WORKSHOP
IEEE NTUA SB
Arduino Starter WORKSHOP
IEEE NTUA SB
Arduino Starter WORKSHOP
粒虜留略留侶 虜留旅 僚隆竜侶
http://arduino.cc/en/Main/Software
IEEE NTUA SB
Arduino Starter WORKSHOP
凌粒留亮亮留旅亮
IEEE NTUA SB
setup ()
 了竜旅凌粒溜留 setup () 虜留了竜溜留旅
留僚 両竜虜旅僚略 劉僚留 粒留亮亮留.
律侶旅亮凌凌旅竜溜竜 粒旅留 僚留 凌竜凌旅亮略竜旅
亮竜留硫了侶劉, 凌 凌 竜留ホ,
竜旅留粒粒流 硫旅硫了旅凌慮侶虜ホ, 虜.了.
 了竜旅凌粒溜留 setup() 慮留 劉両竜旅
亮僚凌 亮溜留 凌略, 亮竜略 留 虜略慮竜
竜虜虜溜僚侶侶 流
竜留僚留凌略 (reset) 旅 了留虜劉留
Arduino.
留略隆竜旅粒亮留
int buttonPin = 3;
void setup ()
{
Serial.begin (9600);
pinMode (buttonPin, INPUT);
}
略虜侶 硫凌 ()
{
// ...
}
Arduino Starter WORKSHOP
loop ()
 了竜旅凌粒溜留 loop() 虜略僚竜旅 留虜旅硫マ 留
凌 凌隆侶了ホ塾砧 凌 僚凌亮略 侶,
隆旅留隆凌旅虜劉 竜虜竜了劉竜旅, 竜旅劉凌僚留
凌 粒留亮亮略 留 僚留 留了了略両竜旅 虜留旅
僚留 竜了劉粒両竜旅 了竜 侶 竜旅隆凌 虜留旅
竜両隆凌 凌 亮旅虜凌竜了竜粒虜流 虜留慮マ 虜留旅
侶 竜旅虜凌旅僚僚溜竜 亮竜 略了了竜 虜竜劉.
IEEE NTUA SB
留略隆竜旅粒亮留
const int buttonPin = 3;
void setup(){
Serial.begin(9600);
pinMode(buttonPin, INPUT);}
void loop(){
if (digitalRead(buttonPin) == HIGH)
Serial.write('H');
else
Serial.write('L');
delay(1000);}
Arduino Starter WORKSHOP
IEEE NTUA SB
Arduino Starter WORKSHOP
IEEE NTUA SB
BLINK A LED
IEEE NTUA SB
BLINK A LED
IEEE NTUA SB
int led = 13;
void setup() {
pinMode(led, OUTPUT); }
void loop() {
digitalWrite(led, HIGH);
delay(1000);
digitalWrite(led, LOW);
delay(1000); }
BLINK A LED
IEEE NTUA SB
FADE A LED
IEEE NTUA SB
analogWrite(pin-name, value)
FADE A LED
IEEE NTUA SB
FADE A LED
IEEE NTUA SB
int led = 9;
int brightness = 0;
int fadeAmount = 5;
void setup() {
pinMode(led, OUTPUT);
}
void loop() {
analogWrite(led, brightness);
brightness = brightness + fadeAmount;
if (brightness == 0 || brightness == 255) {
fadeAmount = - fadeAmount ;
}
delay(30);
}
PRESS A BUTTON
IEEE NTUA SB
PRESS A BUTTON
IEEE NTUA SB
int pushButton = 2;
void setup() {
Serial.begin(9600);
pinMode(pushButton, INPUT);
}
void loop() {
int buttonState = digitalRead(pushButton);
Serial.println(buttonState);
delay(1);
}
IEEE NTUA SB
int pushButton = 2, led = 13, ledState = LOW;
void setup() {
Serial.begin(9600);
pinMode(pushButton, INPUT);
pinMode(led, OUTPUT);
}
void loop() {
int buttonState = digitalRead(pushButton);
if(buttonState == HIGH){
if(ledState == HIGH){
ledState = LOW;
}else{
ledState = HIGH;
}
}
digitalWrite(led,ledState);
delay(1);
}
Read Analog Signals
IEEE NTUA SB
void setup()
{Serial.begin(9600); }
void loop()
{int sensorValue = analogRead(A0);
Serial.println(sensorValue);
delay(1); }
void setup()
{Serial.begin(9600);}
void loop()
{int sensorValue = analogRead(A0);
float voltage = sensorValue * (5.0 / 1023.0);
Serial.println(voltage);}

More Related Content

IEEE NTUA SB - Arduino Workshop vol 1

  • 1. ARDUINO Arduino Starter Workshop 旅旅略了侶 裡凌 留僚留粒旅留虜凌了凌 律流凌 旅溜僚侶 マ留 留流 溜虜凌 IEEE NTUA SB
  • 2. Arduino Starter IEEE NTUA SB 稽旅留粒粒流 凌 micro-controllers 稽了了侶了竜溜隆留侶 侶了竜虜凌僚旅虜ホ 竜留ホ 稽了了侶了竜溜隆留侶 侶了竜虜凌僚旅虜ホ 竜留ホ 亮竜 粒留亮亮留
  • 5. Arduino Starter WORKSHOP 粒虜留略留侶 虜留旅 僚隆竜侶 http://arduino.cc/en/Main/Software IEEE NTUA SB
  • 6. Arduino Starter WORKSHOP 凌粒留亮亮留旅亮 IEEE NTUA SB setup () 了竜旅凌粒溜留 setup () 虜留了竜溜留旅 留僚 両竜虜旅僚略 劉僚留 粒留亮亮留. 律侶旅亮凌凌旅竜溜竜 粒旅留 僚留 凌竜凌旅亮略竜旅 亮竜留硫了侶劉, 凌 凌 竜留ホ, 竜旅留粒粒流 硫旅硫了旅凌慮侶虜ホ, 虜.了. 了竜旅凌粒溜留 setup() 慮留 劉両竜旅 亮僚凌 亮溜留 凌略, 亮竜略 留 虜略慮竜 竜虜虜溜僚侶侶 流 竜留僚留凌略 (reset) 旅 了留虜劉留 Arduino. 留略隆竜旅粒亮留 int buttonPin = 3; void setup () { Serial.begin (9600); pinMode (buttonPin, INPUT); } 略虜侶 硫凌 () { // ... }
  • 7. Arduino Starter WORKSHOP loop () 了竜旅凌粒溜留 loop() 虜略僚竜旅 留虜旅硫マ 留 凌 凌隆侶了ホ塾砧 凌 僚凌亮略 侶, 隆旅留隆凌旅虜劉 竜虜竜了劉竜旅, 竜旅劉凌僚留 凌 粒留亮亮略 留 僚留 留了了略両竜旅 虜留旅 僚留 竜了劉粒両竜旅 了竜 侶 竜旅隆凌 虜留旅 竜両隆凌 凌 亮旅虜凌竜了竜粒虜流 虜留慮マ 虜留旅 侶 竜旅虜凌旅僚僚溜竜 亮竜 略了了竜 虜竜劉. IEEE NTUA SB 留略隆竜旅粒亮留 const int buttonPin = 3; void setup(){ Serial.begin(9600); pinMode(buttonPin, INPUT);} void loop(){ if (digitalRead(buttonPin) == HIGH) Serial.write('H'); else Serial.write('L'); delay(1000);}
  • 10. BLINK A LED IEEE NTUA SB
  • 11. BLINK A LED IEEE NTUA SB int led = 13; void setup() { pinMode(led, OUTPUT); } void loop() { digitalWrite(led, HIGH); delay(1000); digitalWrite(led, LOW); delay(1000); }
  • 12. BLINK A LED IEEE NTUA SB
  • 13. FADE A LED IEEE NTUA SB analogWrite(pin-name, value)
  • 14. FADE A LED IEEE NTUA SB
  • 15. FADE A LED IEEE NTUA SB int led = 9; int brightness = 0; int fadeAmount = 5; void setup() { pinMode(led, OUTPUT); } void loop() { analogWrite(led, brightness); brightness = brightness + fadeAmount; if (brightness == 0 || brightness == 255) { fadeAmount = - fadeAmount ; } delay(30); }
  • 17. PRESS A BUTTON IEEE NTUA SB int pushButton = 2; void setup() { Serial.begin(9600); pinMode(pushButton, INPUT); } void loop() { int buttonState = digitalRead(pushButton); Serial.println(buttonState); delay(1); }
  • 18. IEEE NTUA SB int pushButton = 2, led = 13, ledState = LOW; void setup() { Serial.begin(9600); pinMode(pushButton, INPUT); pinMode(led, OUTPUT); } void loop() { int buttonState = digitalRead(pushButton); if(buttonState == HIGH){ if(ledState == HIGH){ ledState = LOW; }else{ ledState = HIGH; } } digitalWrite(led,ledState); delay(1); }
  • 19. Read Analog Signals IEEE NTUA SB void setup() {Serial.begin(9600); } void loop() {int sensorValue = analogRead(A0); Serial.println(sensorValue); delay(1); } void setup() {Serial.begin(9600);} void loop() {int sensorValue = analogRead(A0); float voltage = sensorValue * (5.0 / 1023.0); Serial.println(voltage);}