Elie Zananiri and I decided to make a fluid that would allow us to create liquid circuits. We tried many different combinations of the materials: water, oil, salt, powder graphite, and glue. The best combination was water, salt, and graphite, which resulted in a mixture that gave a steady reading of about 100 ohms. We used the liquid to create both a drawn circuit and an irrigation circuit.
Recently I have been playing with a light that is made up of a 12x12 grid of RGB LEDs. I made a 5 minute video of most of the sketches I made in the last three days.
For week two I had to use a sensor(analog in) to send information to the Arduino that then used the data to regulate something else. In my case I used 3 potentiometers that controlled blue, green and red LEDs.
I wanted to create a way to make many different colors. I put the LEDs inside of a cube of foamcore with a paper window. Watch the videos to see how it went.
My brother Kevin, who lives in Florida and works as a Flash developer, had an idea about how to fix my code. He sent me a snippet of the void loop() section and I swapped it in and then rearranged the variables.
His idea was to check the switchState on every iteration of the for loop. Since switchState would only return 0 or 1(no or yes), he added the value of switchState to the lower of the two LED pins(pin 3) which were in pins 3 and 4.
Code snippet: void loop() { for (int i=10; i >= 1; i--){ // read the switch input at the beginning of // each loop iteration switchState = digitalRead(switchPin); digitalWrite((ledPin + switchState), HIGH); delay(i*(i*10)); digitalWrite((ledPin + switchState), LOW); delay(i*(i*10)); }
I finally got my Arduino Diecimila to work on my computer. I was really excited about programming in Arduino. It seemed like such a simple language that I just wanted to dive in and play around a bit.
I played with for loops allowing the LEDs to blink at either an exponentially increasing or decreasing amount. The LED that turns on depends on the position of a switch, whether it is open or closed. Here is my code:
// declare variables: int switchPin = 2; // digital input pin for a switch int yellowLedPin = 3; // digital output pin for an LED int redLedPin = 4; // digital output pin for an LED int switchState = 0; // the state of the switch
void setup() { pinMode(switchPin, INPUT); // set the switch pin to be an input pinMode(yellowLedPin, OUTPUT); // set the yellow LED pin to be an output pinMode(redLedPin, OUTPUT); // set the red LED pin to be an output }
if (switchState == 1) // if the switch is closed: for (int i=10; i >= 1; i--){ digitalWrite(yellowLedPin, HIGH); // turn on the yellow LED delay(i*(i*10)); digitalWrite(yellowLedPin, LOW); // turn off the yellow LED delay(i*(i*10)); } digitalWrite(redLedPin, LOW); // turn off the red LED } else if (switchState == 0){ // if the switch is open: for (int i=1; i <= 10; i++){ digitalWrite(redLedPin, HIGH); // turn on the red LED delay(i*(i*10)); digitalWrite(redLedPin, LOW); // turn off the red LED delay(i*(i*10)); } digitalWrite(yellowLedPin, LOW); // turn off the yellow LED } } Here is a video:
The LEDs blinked the way I wanted them to, but the switch wouldn't change the lit LED until after the currently lit one was finished its for loop. I tried adding an if statement with a break to get the for loop to stop, but it didn't work.