Regena’s Arduino Homework 2

Link to Instagram videos still not syncing. Please view videos here:

//Code for two buttons controlling the LED. Pushing either of the two buttons will turn the LED on.

const int onbuttonPin = 2;    // the number of the pushbutton pin that turns LED on
const int offbuttonPin = 4;   // the number of the pushbutton pin that turns LED off
const int ledPin = 13;        // the number of the LED pin

// variables will change:
int buttonState1 = 0;         // variable for reading the on pushbutton status
int buttonState2 = 0;         // variable for reading the off pushbutton status

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
  // initialize the on pushbutton pin as an input:
  pinMode(onbuttonPin, INPUT);
  // initialize the off pushbutton pin as an input:
  pinMode(offbuttonPin, INPUT);

void loop() {
  // read the state of the pushbutton value:
  buttonState1 = digitalRead(onbuttonPin);
  buttonState2 = digitalRead(offbuttonPin);
  // check if the pushbutton is pressed. If it is, the buttonState is HIGH:
  if (buttonState1 == LOW) {
    // turn LED on
    digitalWrite(ledPin, HIGH);
  } else if (buttonState2 == LOW){
      digitalWrite(ledPin, HIGH);
  } else {
    // turn LED off:
    digitalWrite(ledPin, LOW);

testing instagram embed using the “instagram” wordpress block:

One thought on “Regena’s Arduino Homework 2”

  1. Hi Regena, that Instagram link doesn’t work for me, could you try again? I tested embedding an Insta video using the wordpress block called “instagram” and it seems to have worked. I can show you in class.

Comments are closed.

%d bloggers like this: