This file contains hidden or 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
| main:' LCD test with phanderson.com seral controller chip - 23/03/2010 | |
| wait 5 ' it takes a moment for the chip to boot and the LCD to wake up | |
| 'serout 2, T2400, ("?S2") ' show my copyright message [as shown below] at boot | |
| 'wait 1 | |
| 'serout 2, T2400, ("?f") ' clear screen | |
| 'wait 1 | |
| 'serout 2, T2400, ("?c0") ' turns off blinking cursor | |
| 'wait 1 | |
| 'serout 2, T2400, ("?C0copyright 2010 ") ' set top line of initial boot message | |
| 'wait 1 |
This file contains hidden or 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
| ?a - set cursor to home position. | |
| ?b - destructive backspace | |
| ?f - clear LCD and leave cursor at home position | |
| ?g - beep | |
| ?h - backspace | |
| ?i - forward cursor | |
| ?j - up cursor | |
| ?k - down cursor | |
| ?l - clear current line and leave cursor at the beginning of the line | |
| ?m - carriage return. Position the cursor at the beginning of the current line. |
This file contains hidden or 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
| Serial.print("The temperature is: "); | |
| Serial.print(temperature, 2); | |
| Serial.println(" degrees Celsius"); |
This file contains hidden or 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
| /* | |
| example 2.1 - digital thermometer | |
| Created 14/04/2010 --- By John Boxall --- http://tronixstuff.wordpress.com --- CC by-sa v3.0 | |
| Uses an Analog Devices TMP36 temperature sensor to measure temperature and output values to the serial connection | |
| Pin 1 of TMP36 to Arduino 5V power socket | |
| Pin 2 of TMP36 to Arduino analog 0 socket | |
| Pin 3 of TMP36 to Arduino GND socket | |
| */ | |
| void setup() |
This file contains hidden or 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
| while (digitalRead(3) == LOW) | |
| { | |
| Serial.writeln("Button on digital pin 3 has not been pressed"); | |
| } |
This file contains hidden or 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
| /* | |
| exercise 2.1 - Climate Control Judge | |
| Created 14/04/2010 --- By John Boxall --- http://tronixstuff.wordpress.com --- CC by-sa v3.0 Share the love! | |
| Measures temperature with Analog Devices TMP36 and compares against minimum temperature to use a heater or air conditioner | |
| */ | |
| int redLED = 13; // define which colour LED is in which digital output | |
| int greenLED = 12; | |
| int blueLED = 11; | |
| float voltage = 0; // set up some variables for temperature work |
This file contains hidden or 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
| digitalWrite(2, HIGH); // turn on LED on pin 2 | |
| delay(del); // wait (length determined by value of ‘del’) | |
| digitalWrite(2, LOW); // turn it off | |
| digitalWrite(3, HIGH); // turn on LED on pin 3 | |
| delay(del); // wait | |
| digitalWrite(3, LOW); // turn it off | |
| digitalWrite(4, HIGH); // turn on LED on pin 4 | |
| delay(del); // wait | |
| digitalWrite(4, LOW); // turn it off | |
| digitalWrite(5, HIGH); // turn on LED on pin 5 |
This file contains hidden or 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
| // Example 1.1 - using the 'for' command | |
| void setup() | |
| { | |
| pinMode(9, OUTPUT); // initialise the digital pin 9 as an output | |
| } | |
| void loop() | |
| { | |
| for (int wow = 1; wow <= 5; wow++) | |
| { |
This file contains hidden or 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
| // Exercise 1.1 | |
| int del=100; // sets a default delay time, 1000 milliseconds (one second) | |
| void setup() | |
| { | |
| // initialize the digital pins as outputs: | |
| for (int i = 2; i<=9 ; i++) | |
| { | |
| pinMode(i, OUTPUT); | |
| } // end of for loop |
This file contains hidden or 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
| // Example 1.2 | |
| int red = 11; // the pins for the LED | |
| int green = 9; | |
| int blue = 10; | |
| int i = 0; // for loops | |
| int j = 0; | |
| void setup() | |
| { |