Site Map - skip to main content

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes every weekday Monday through Friday.
This page was generated by The HPR Robot at


hpr1908 :: Arduino Pumpkin

droops talks about how his class built a pumpkin that comes alive for halloween.

<< First, < Previous, , Latest >>

Thumbnail of droops
Hosted by droops on 2015-11-25 is flagged as Clean and is released under a CC-BY-NC-SA license.
Arduino, Arduino Uno, LED, pumpkin, Halloween. 1.
The show is available on the Internet Archive at: https://archive.org/details/hpr1908

Listen in ogg, spx, or mp3 format. Play now:

Duration: 00:07:28

Arduino and related devices.

In this series various contributors talk about how to use and program Arduino single-board microcontrollers and related devices.
See the Wikipedia article https://en.wikipedia.org/wiki/List_of_Arduino_boards_and_compatible_systems for details of the range of devices.

Code for Pumpkin

int ledPin1 = 5;
int ledPin2 = 6;
int motorPin = 8;
int lightPin = 3;
int lightVal;
int potPin = 0;
int potVal;

void setup(){
  Serial.begin(9600);
  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);
  pinMode(motorPin, OUTPUT);
  pinMode(potPin, INPUT);
  pinMode(lightPin, INPUT);
  digitalWrite(ledPin1, LOW);
  digitalWrite(ledPin2, LOW);
  digitalWrite(motorPin, LOW);
}

void loop(){
  potVal = analogRead(potPin);
  lightVal = analogRead(lightPin);
  Serial.println(lightVal);
  if (lightVal < potVal){
    animate();
  }
}

void animate(){
  digitalWrite(ledPin1, HIGH);
  digitalWrite(ledPin2, HIGH);
  digitalWrite(motorPin, HIGH);
  delay(100);
  digitalWrite(ledPin1, LOW);
  digitalWrite(ledPin2, LOW);
  digitalWrite(motorPin, LOW);
}

Comments

Subscribe to the comments RSS feed.

Comment #1 posted on 2015-11-28 22:01:21 by Dave Morriss

Loved this!

A very cool project.

I'm in envy of your students.

Leave Comment

Note to Verbose Commenters
If you can't fit everything you want to say in the comment below then you really should record a response show instead.

Note to Spammers
All comments are moderated. All links are checked by humans. We strip out all html. Feel free to record a show about yourself, or your industry, or any other topic we may find interesting. We also check shows for spam :).

Provide feedback
Your Name/Handle:
Title:
Comment:
Anti Spam Question: What does the letter P in HPR stand for?
Are you a spammer?
What is the HOST_ID for the host of this show?
What does HPR mean to you?