User:DukeEgr93/Arduino 110
Jump to navigation
Jump to search
This page will serve as development space for the ECE 110 conversion to Arduinos.
Contents
Document Preparation
Section | Last Update | Status | Notes |
Preface | 12/19/2013 | Ready | |
Updates | 12/19/2013 | Ready | removed |
Acknowledgments | 12/19/2013 | Ready | |
Lab 1 | 12/23/2013 | Ready | |
Lab 2 | 12/23/2013 | Drafting | |
Lab 1
Connecting the Parallax Digital Trainer to the BOE Shield
This requires two male-to-male 3-header cables.
- The first cable will go from channels GND/13/12 on the BOE Shield to channels GND/P0/P1 on the PDT. The black wire should be on GND; for the BOE Shield, that is the second-to-leftmost pin on the top bus while for the PDT, that is the fourth pin from the top on the left of the socket.
- The second cable will go from channels 2/3/4 on the BOE Shield to P2/P3/P4 on the PDT. The black wire should be on pin 2 of the BOE Shield and in the sixth-from-the-bottom socket on the PDT. The white wire should be on pin 4 of the BOE Shield and in the fourth-from-the-bottom socket on the PDT.
Programs
OneBitCounter.ino
void setup() {
pinMode(2, OUTPUT); // set pin 2 to output mode
digitalWrite(2, LOW); // set pin 2 to LOW voltage
}
void loop() {
delay(500); // wait for 0.5 sec
digitalWrite(2, HIGH); // set pin 2 to HIGH - light 0 on
delay(500); // wait for 0.5 sec
digitalWrite(2, LOW); // set pin 2 to LOW - light 0 off
}
TwoBitCounter.ino
void setup() {
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
digitalWrite(2, LOW);
digitalWrite(3, LOW);
}
void loop() {
delay(500);
digitalWrite(2, HIGH);
delay(500);
digitalWrite(2, LOW);
digitalWrite(3, HIGH);
delay(500);
digitalWrite(2, HIGH);
delay(500);
digitalWrite(2, LOW);
digitalWrite(3, LOW);
}
TwoBitCounterToggle.ino
void setup() {
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
digitalWrite(2, LOW);
digitalWrite(3, LOW);
}
void loop() {
delay(500);
digitalWrite(2, !digitalRead(2));
delay(500);
digitalWrite(2, !digitalRead(2));
digitalWrite(3, !digitalRead(3));
}