Frogs are high in protein. Good for skin.
Coconut milk high in cholesterol. Bad for heart.
Frog under a coconut shell. Good for brains, bad for shit-brained.
Visit to my 365 Blog @ http://365-knocks-n-bruises.blogspot.com
Monday, September 5, 2011
Naza Porn Session
This time is just to have a look at the 458 and FF. Coz we have to.
First thing we saw was the 458 parked at the entrance.
Was porning all over the 458.
Ssad that the FF was shipped to Indonesia as it was actually on tour. Person-in-charge there say they will officially bring in the FF next year.
Similarities are drawn to the rear end of a fine female specimen.
It’s weird how I can identify the material as carbon-ceramic, despite having no knowledge about the 458 brakes in advance. Materials module did not fail me. Haha.
Part of the interior. Reflection was an issue so can’t capture much. Classy nonetheless.
Filtered away a few pics to be placed at my photography blog (they were, less journalistic). Click here to go there.
Friday, August 19, 2011
Arduino Solar Tracker Using LDRs
I’ve always wanted to make a solar tracker. Watched a few youtube videos and decided to make one myself.
The circuitry:
And the sketch itself. I’ve uploaded it to pastebin.com for easy reference.
I tried to make a horizontal movement function and a vertical movement function, and call them in the loop function but it keeps failing to call them. Decided to leave the if- statements in the open like that.
Tuesday, August 2, 2011
Help needed to troubleshoot [solved]
This is the first project that I sortof created myself, combining what I’ve learnt so far about Arduino sketching and circuitry.
I am trying to make an on/off switch thingy. One click on the button should turn the LED on (and remain off), another click should turn it off (and remain off). However The code does not seem to stick, and random misconducts appear to happen. Sometimes the first few clicks would function as expected, then the behavior turns erratic. Other times even the first few click also does not turn the LED on (it blinks, or remains on even after a second click). I hope anyone with knowledge in the subject can help me out.
As you can see in this scenario the first few clicks function as expected, then it just doesn’t work well until after a few more clicks later.
The following is the sketch:
int ledPin = 12;
int buttonPin = 2;
int loopcount = 0;
void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
digitalWrite(ledPin, LOW);
}
void loop()
{
int buttonState = digitalRead(buttonPin);
if (buttonState == HIGH)
{
changeState();
}
}
void changeState()
{
loopcount++;
if(loopcount%2 != 0)
{
digitalWrite(ledPin, HIGH);
}
if(loopcount%2 == 0)
{
digitalWrite(ledPin, LOW);
}
}
My concept of making it a switch is based on counting the number of times the button has been pressed( loo[count++ ), calculating whether the n-th time is an even or odd number (loopcount%2 == 0 ), and assigning that when it is odd numbered to turn the LED on (if statement).
The circuitry is exactly the same as the interactive traffic light one, just that I pulled off all the excess LEDs and wires and resistors, leaving the button and the sole LED. This meant that the circuit is valid and closed.
UPDATE: having watched this video, I realise there's much more to think about when it comes to playing with arduino (or any electrical stuff for that matter).
The fixed code:
int switchPin = 8;
int ledPin = 13;
boolean lastButton = LOW;
boolean ledOn = false;
boolean currentButton = LOW;
void setup()
{
pinMode(switchPin, INPUT);
pinMode(ledPin, OUTPUT);
}
boolean debounce(boolean last)
{
boolean current = digitalRead(switchPin);
if (last != current)
{
delay(5);
current = digitalRead(switchPin);
}
return current;
}
void loop()
{
currentButton = debounce(lastButton);
if (lastButton == LOW && currentButton == HIGH)
{
ledOn = !ledOn;
}
lastButton = currentButton;
digitalWrite(ledPin, ledOn);
}
I do not fully understand the boolean parts of the code, so might need help there.
Glad that I finally made it thru making an on/off switch! Though not on my own efforts as initially hoped for.
Sunday, July 31, 2011
Connecting a seven-segment LED to Arduino UNO
There are a few tutorials that sadly, I am unable to perform due to the lack of components in my starter kit. I am trying to hunt down a thermistor and a servo motor. Before those 2 are obtained, I wanted to fully exploit the current components first. So in this post I connect a seven segment LED to the Arduino UNO board.
The instructions and codes were from hacktronics.com.
The picture of the circuit:
Good thing the kit had enough resistors. The resistors used were 330k Ohm ones.
LED Bounce Off Centre effect on Arduino UNO
One of the additional exercises in the manual was to add codes so that the LED blinkings appear to bounce off each other in the middle. The original project (Project 6) was to make an LED chase effect where the LEDs blink one at a time in sequence from one end to the other, and back the opposite direction.
The picture of circuit:
The code in its entirety:
byte ledPin[] = {7, 8, 9, 10, 11, 12, 13};
int ledDelay;
int Direction1 = 1;
int Direction2 = -1;
int currentLED = 0;
int lastLED = 6;
unsigned long changeTime;
int x;
int potPin = 2;
void setup(){
for(int x=0; x<7; x++){
pinMode(ledPin[x], OUTPUT);
pinMode(ledPin[6-x], OUTPUT); }
changeTime = millis();
}
void loop(){
ledDelay = analogRead(potPin);
if ((millis() - changeTime) > ledDelay) {
changeLED();
changeTime = millis();
}
}
void changeLED(){
for (int x=0; x<7; x++){
digitalWrite(ledPin[x], LOW);
digitalWrite(ledPin[6-x], LOW);
}
digitalWrite(ledPin[currentLED], HIGH);
digitalWrite(ledPin[lastLED], HIGH);
currentLED += Direction1;
lastLED +=Direction2;
if (currentLED == 3){Direction1 = -1;}
if (currentLED == 0) {Direction1 = 1;}
if (lastLED == 6){Direction2 = -1;}
if (lastLED == 3){Direction2 = 1;}
}
Basically what I did was I added another integer variable, lastLED and made it a 2nd output, since there will be 2 separate blinkings at one time. I duplicate whatever the code there is for currentLED for lastLED. Also added a second direction variable so that the new blinking can have an opposite direction to the first blinking. Made them start at different ends but end in the middle. I maintained the potentiometer-controlled ledDelay variable.
Not too bad for a total noob eh?
Saturday, July 30, 2011
Pedestrian Interactive Traffic Light using Arduino UNO
This is a pedestrian interactive traffic light made using Arduino UNO. This is project 4 from the manual that can be found at this link.
Photo of circuit:
The code is as follows:
int carRed = 12;
int carYellow = 11;
int carGreen = 10;
int pedRed = 9;
int pedGreen = 8;
int button = 2;
int crossTime = 5000;
unsigned long changeTime;
int x;
void setup(){
pinMode(carRed, OUTPUT);
pinMode(carYellow, OUTPUT);
pinMode(carGreen, OUTPUT);
pinMode(pedRed, OUTPUT);
pinMode(pedGreen, OUTPUT);
pinMode(button, INPUT);
digitalWrite(carGreen, HIGH);
digitalWrite(pedRed, HIGH);
}
void loop(){
int state = digitalRead(button);
if (state == HIGH && (millis() - changeTime) > 5000){
changeLights();
}
}
void changeLights(){
digitalWrite(carGreen, LOW);
digitalWrite(carYellow, HIGH);
delay(2000);
digitalWrite(carYellow, LOW);
digitalWrite(carRed, HIGH);
delay(1000);
digitalWrite(pedRed, LOW);
digitalWrite(pedGreen, HIGH);
delay(crossTime);
for(int x=0; x<10; x++){
digitalWrite(pedGreen, HIGH);
delay(250);
digitalWrite(pedGreen, LOW);
delay(250);
}
digitalWrite(pedRed, HIGH);
delay(500);
digitalWrite(carYellow, HIGH);
digitalWrite(carRed, LOW);
delay(1000);
digitalWrite(carGreen, HIGH);
digitalWrite(carYellow, LOW);
changeTime = millis();
}
In human language, the following describes what the traffic light was doing:
1. Traffic light waits for user input. The time since the circuit was turned on was continuously logged.
2. If button is pushed, and the last light change was more than 5 seconds ago (determined by subtracting the time recorded at end of last light change and time since circuit was turned on), the yellow light turns on for 2 seconds.
3. Then the red light turns on.
4. After 1 second, the green light for pedestrian turns on for 10 seconds.
5. Pedestrian green light starts blinking 10 times after that.
6. Pedestrian red light turns on.
7. After 0.5 seconds, yellow lights for cars turn on for 1 second.
8. Yellow and red lights for cars turn off, and green light turns on.
9. Traffic light listens for user input. Time since circuit was turned on was recorded at this point.
Traffic Light using Arduino UNO
This is the first proper things I did with the Arduino UNO. The blinking LEDs one don’t really count, do they?
Anyway, this is Project 3 from the tutorial at this link.
The circuit is as follows:
Proper schematic can be found at the manual linked earlier.
And the code is as follows:
int ledDelay = 10000;
int redPin = 10;
int yellowPin = 8;
int greenPin = 9;
void setup(){
pinMode(redPin, OUTPUT);
pinMode(yellowPin, OUTPUT);
pinMode(greenPin, OUTPUT);
}
void loop(){
digitalWrite(redPin, HIGH);
delay(ledDelay);
digitalWrite(yellowPin, HIGH);
delay(2000);
digitalWrite(greenPin, HIGH);
digitalWrite(redPin, LOW);
digitalWrite(yellowPin, LOW);
delay(ledDelay);
digitalWrite(yellowPin, HIGH);
digitalWrite(greenPin, LOW);
delay(2000);
digitalWrite(yellowPin, LOW);
}
What it was doing is described below:
1. The red light will be on for 10 secs, then remains on while the yellow light turn on for 2 seconds.
2. After that both lights will turn off and the green light turns on for 10 second.
3. After that the green light remains on while the yellow light turns on for 2 seconds.
4. Loop repeats.
Arduino!
K so I’ve just gotten myself an Arduino UNO starter kit from myduino.com. The item that I bought can be found in this link. Downloaded the document from the same page and will be learning how to do shits with an Arduino board. I wish to eventually develop accessories using the Android ADK, so let’s hope I persevere till then.
Saturday, June 11, 2011
Nokia's Biggest Angry Birds Playground Guiness Book of World Records Attempt
My contribution to the cause. Woohoo!!!
There's a booth where there's this real angry birds slingshot game, of course using plush toys. Quite lame la coz the structure itself it like not destructible.
Hey! Pay a visit to my 365 Blog @ http://365-knocks-n-bruises.blogspot.com
Tuesday, May 31, 2011
Plague
Went to see the dentist today for my first dental checkup. No need to do fillings, but need to do scaling. Always hear ppl say scaling scaling, I thought it's an easy procedure.
Nope.
Let's just say I genuinely felt pieces of my teeth coming out. Well plagues are literally part of your teeth when they start mineralising.
Piees of stuff are still coming out of my teeth although it's been 12 hours since the procedure. Felt a few came out and decided to take pics.
Doc asked me to go back for checkup 6 months later. Diuuuu...
Gonna brush my teeth harder today onwards.
=============================
Hey! Pay a visit to my 365 Blog @ http://365-knocks-n-bruises.blogspot.com