Little Programming Experience... Please help

Hello I’m a college student in a circuit fundamentals class. I was assigned to make my own circuit using an Arduino UNO and some basic components. So far I have the build that I want to program done, but writing the program is somewhat tedious. I wanted to have a theme of some form of alarm clock that is associated with timing using the default millis() function from the Arduino IDE. I have snippets of code from various projects I’ve done as class assignments, but I’m unsure whether throwing them together will work.

I know the basics of coding, but only in python or java. I was wondering if there was someone that could help me figure out how to write this code such that I won’t have to go through the troubleshooting process seeing as how my project is due tomorrow.

I’m very grateful for any help or advice! I’ve attached what I currently have built and below is a basic fundamental flow chart of my intended circuit:

  1. The switch begins a counting time
  2. The tilt switch allows for full reset of said time

This is my personal struggles:

  1. The multicolor LED is connected to three pins (5,6,7)

I would like to run a RGB spectrum through this LED.

  1. As the LED progresses with time, the single color LEDs will light up as the multicolor LED emits that color in the following order (Red, Yellow, Green, Cyan).

  2. As the light progresses I’d like the photoresistor to transmit a similar progressively weaker resistance such that the piezo speaker gets louder.

  3. Along with the color progression, I would like my piezo speaker to ring progressively louder.

The colors are for the effect of a sunrise if anyone is curious. If the picture is unclear I have a list of associated connections for each of the pieces below:

Pin # - Device

2 - Switch output
4 - Tiltswtich output
5, 6, 7 - Multi-color LED input
8 - Piezo Input
10, 11, 12, 13 - single color LED inputs (Cyan, Green, Yellow, Red; respectively)
A0 - Photoresistor Input

Collision95:
I was wondering if there was someone that could help me figure out how to write this code such that I won't have to go through the troubleshooting process seeing as how my project is due tomorrow.

I think this shows an attitude problem: " but writing the program is somewhat tedious.". Why is it any more tedious than getting up in the morning and going to school?

Have you used the example programs to test each component for your project or have you written simple programs to experiment with the LEDs? IF not, then trying to do the final program is going to be really frustrating! Start simply. Study the sticky post about doing many things at once. And perhaps the "state machine" examples.

Paul

You need to connect the RGB LED to PWM pins 3,5,6,9,10,11 (the ones with the wavy mark next to the number).

You might have better luck posting in the Gigs & Collaborations section if you need this tomorrow.

Oh dear.

Collision95:
but writing the program is somewhat tedious

Then maybe you should delegate the programming task to someone who finds it enjoyable - lots of people do.

...R

The best approach is just to start with something simple, adding the features you need one by one. Debug each before you move on to the next. Normally I'd build up the circuit at the same time because things often don't work out the way I imagined at the beginning.

Don't use delay().

It sounds like you need a state machine.

If you can do Java you can quickly learn C++. They're very similar in a lot of ways, especially at first.

Ask here if you have specific questions and people will help. But as you've seen, people will be reluctant to do it for you - it's hard to write the code when we don't have access to your circuit. And besides, this is your homework, it's supposed to be part of your education.

Collision95's post about this in Gigs and Collaborations: