User:ZUZU/SI 22: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
No edit summary
Line 10: Line 10:
==== Use Arduino to control LED lights ====
==== Use Arduino to control LED lights ====
*[https://interactionstation.wdka.hro.nl/wiki/Getting_Started_with_Arduino_%26_Lights Getting Started with Arduino & Lights]
*[https://interactionstation.wdka.hro.nl/wiki/Getting_Started_with_Arduino_%26_Lights Getting Started with Arduino & Lights]
use loop to make mini traffic lights:
  int greenLed = 13;
  int yellowLed = 12;
  int redLed = 11;
  void setup() {
    // put your setup code here, to run once:
    pinMode(13, OUTPUT); //green
    pinMode(12, OUTPUT); //yellow
    pinMode(11,OUTPUT); // red
  }
  void loop() {
    // put your main code here, to run repeatedly:
    //turn green light on for 0.5 seconds
    digitalWrite(13,HIGH);
    delay(500);
    //turn off green light and turn yellow light on for 0.5 second
    digitalWrite(13,LOW);
    digitalWrite(12,HIGH);
    delay(500);
    // turn yellow off anf turn red on for 0.5 seconds
    digitalWrite(12,LOW);
    digitalWrite(11,HIGH);
    delay(500);
    digitalWrite(11,LOW);
  }


== WEEK 9 ==
== WEEK 9 ==

Revision as of 02:37, 13 November 2023

I used to use Apple pages to keep a record of what I learned, but they were always a bit of a mess, so I'm going to start using a Wiki. hopefully, it will help me improve the situation.

WEEK 8

Friday 10 November

Use Arduino to control LED lights

use loop to make mini traffic lights:

 int greenLed = 13;
 int yellowLed = 12;
 int redLed = 11;
 void setup() {
   // put your setup code here, to run once:
   pinMode(13, OUTPUT); //green 
   pinMode(12, OUTPUT); //yellow
   pinMode(11,OUTPUT); // red
 }
 void loop() {
   // put your main code here, to run repeatedly:
   //turn green light on for 0.5 seconds
   digitalWrite(13,HIGH);
   delay(500);
   //turn off green light and turn yellow light on for 0.5 second
   digitalWrite(13,LOW);
   digitalWrite(12,HIGH);
   delay(500);
   // turn yellow off anf turn red on for 0.5 seconds
   digitalWrite(12,LOW);
   digitalWrite(11,HIGH);
   delay(500);
   digitalWrite(11,LOW);
 }


WEEK 9

Monday 13 November