BLINK FAST OR SLOW : ARDUINO LETS GO!

So professor Dawn handed out Arduino kits. I Must admit I’m not good with software,  and I have never seen coding before.  So my blog will be so basic….a true newbie  could do it. please feel free to check out all links and YouTube videos i have uploaded, to help better understand Arduino.

EXPLAINING  ARDUINO :

The Arduino Uno is a microcontroller board based on the ATmega328 (data sheet). It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator, a USB connection, a power jack, an ICSP header, and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started.

DIFFERENCE BETWEEN ANALOG AND DIGITAL SIGNALS:

when the board is running on digital signals that means it’s either going to be:

on/off

 0/1

true/false

An analog circuit is a circuit with a continuous, variable signal (that is, an analog signal), as opposed to a digital circuit where a signal must be one of two discrete levels. Analog circuits within electrical equipment can convey information through changes in the current, voltage, or frequency.

POWER :

The Arduino Uno can be powered with the USB connection or with an external power supply. The power source is selected automatically.

External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be connected by plugging a 2.1mm center-positive plug into the board’s power jack. Leads from a battery can be inserted in the Gnd and Vin pin headers of the POWER connector.

The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may be unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts.

THE POWER OF THE PINS GOES AS FOLLOWS:

VIN. The input voltage to the Arduino board when it’s using an external power source (as opposed to 5 volts from the USB connection or other regulated power source). You can supply voltage through this pin, or, if supplying voltage via the power jack, access it through this pin.

5V.This pin outputs a regulated 5V from the regulator on the board. The board can be supplied with power either from the DC power jack (7 – 12V), the USB connector (5V), or the VIN pin of the board (7-12V). Supplying voltage via the 5V or 3.3V pins bypasses the regulator, and can damage your board. We don’t advise it.

3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50 mA.

GND. Ground pins.

IOREF. This pin on the Arduino board provides the voltage reference with which the microcontroller operates. A properly configured shield can read the IOREF pin voltage and select the appropriate power source or enable voltage translators on the outputs for working with the 5V or 3.3V.

Professor asked us to rename the blink sketch (Led blink exercise ).  change the pin, and the delay to blink slower or quicker, then the previous code on a different pin. Use a in-line comment to explain the new code.

below is the arduino kit

robotstarterlknv-dhf-dsf0dsf0ds7f6ds5fds-0004


 

 

here is the arduino uno board rev 3  close up

042014_1355_ArduinoGett1

First install the software, which is linked below

http://arduino.cc/en/Main/Software

https://learn.sparkfun.com/tutorials/installing-arduino-ide

After it is installed , in order to complete the assignment you will need to go to File in the upper right hand corner of the screen, then scroll down to the Sketchbook , in order to obtain the BLINK sketch.

20150303_142826

20150303_142821

20150303_142814bottom part of the code that shows where the delayso are. That’s the numbers I will change in order to alter the speed of the Led blinking

20150303_142745

The Led is inserted into the arduino circuit board.  The short end of the Led leg is negative it goes into the ground pin, and the long leg  is positive that part goes into pin 13.

ExampleCircuit_bb

 

http://www.arduino.cc/en/Tutorial/BlinkWithoutDelay

*/

// constants won’t change. Used here to
// set pin numbers:
const int ledPin =  13;      // the number of the LED pin

// Variables will change:
int ledState = LOW;             // ledState used to set the LED
long previousMillis = 0;        // will store last time LED was updated

// the follow variables is a long because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long interval = 1000;           // interval at which to blink (milliseconds)

void setup() {
// set the digital pin as output:
pinMode(ledPin, OUTPUT);
}

void loop()
{
// here is where you’d put code that needs to be running all the time.

// check to see if it’s time to blink the LED; that is, if the
// difference between the current time and last time you blinked
// the LED is bigger than the interval at which you want to
// blink the LED.
unsigned long currentMillis = millis();

if(currentMillis previousMillis > interval) {
// save the last time you blinked the LED
previousMillis = currentMillis;

// if the LED is off turn it on and vice-versa:
if (ledState == LOW)
ledState = HIGH;
else
ledState = LOW;

// set the LED with the ledState of the variable:
digitalWrite(ledPin, ledState);
}
}

So now i have to re write my code, and comments to match the new code for how fast i know what the LED light to blink….
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(5000); // wait time will now be for five seconds
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(5000); // wait time will now be for five  seconds
}
Blink without using delay video below

 

CT101 Digital Storytelling