// Ultrasonic Sensor testing code. Written by a 13 year old.
//#include // Imports the NewPing Library.
int led0 =(0); // Add the onboard LED on pin 13.
int led1 = (1); // Add the Trig pin on pin 10.
int led2 = (2); // Add the ECHO pin on pin 9.
int led3 = (3); // Add the ECHO pin on pin 9.
int led4 =(4); // Add the onboard LED on pin 13.
int led5 = (5); // Add the Trig pin on pin 10.
int led6 = (6); // Add the ECHO pin on pin 9.
int led7 = (7); // Add the ECHO pin on pin 9.
int led8 =(8); // Add the onboard LED on pin 13.
int led9 = (9); // Add the Trig pin on pin 10.
int led10 = (10); // Add the ECHO pin on pin 9.
int x=0;
void setup()
{
Serial.begin(115200);
pinMode (led0, OUTPUT); // The LED must be controlled by Arduino, it means it is an output type.
pinMode (led1, OUTPUT); // The LED must be controlled by Arduino, it means it is an output type.
pinMode (led2, OUTPUT); // The LED must be controlled by Arduino, it means it is an output type.
pinMode (led3, OUTPUT); // The LED must be controlled by Arduino, it means it is an output type.
pinMode (led4, OUTPUT); // The LED must be controlled by Arduino, it means it is an output type.
pinMode (led5, OUTPUT); // The LED must be controlled by Arduino, it means it is an output type.
pinMode (led6, OUTPUT); // The LED must be controlled by Arduino, it means it is an output type.
pinMode (led7, OUTPUT); // The LED must be controlled by Arduino, it means it is an output type.
pinMode (led8, OUTPUT); // The LED must be controlled by Arduino, it means it is an output type.
pinMode (led9, OUTPUT); // The LED must be controlled by Arduino, it means it is an output type.
pinMode (led10, OUTPUT); // The LED must be controlled by Arduino, it means it is an output type.
}
void loop()
{
x=0;
for(x==0;x<6;x++)
{
if(x==0)
{
digitalWrite (led1, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led2, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led3, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led4, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led4, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led5, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led6, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led7, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led8, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led9, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led10, LOW); // Here, LOW means off and HIGH means on.
}
else if(x==1)
{
digitalWrite (led0, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led1, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led2, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led3, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led4, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led5, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led6, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led7, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led8, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led9, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led10, HIGH); // Here, LOW means off and HIGH means on.
}
else if(x==2)
{
digitalWrite (led0, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led1, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led2, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led3, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led4, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led5, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led6, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led7, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led8, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led9, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led10, HIGH); // Here, LOW means off and HIGH means on.
}
else if(x==3)
{
digitalWrite (led0, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led1, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led2, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led3, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led4, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led5, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led6, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led7, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led8, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led9, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led10, HIGH); // Here, LOW means off and HIGH means on.
}
else if(x==4)
{
digitalWrite (led0, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led1, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led2, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led3, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led4, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led5, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led6, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led7, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led8, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led9, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led10, HIGH); // Here, LOW means off and HIGH means on.
}
else if(x==5)
{
digitalWrite (led0, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led1, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led2, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led3, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led4, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led5, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led6, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led7, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led8, HIGH); // Here, LOW means off and HIGH means on.
digitalWrite (led9, LOW); // Here, LOW means off and HIGH means on.
digitalWrite (led10, HIGH); // Here, LOW means off and HIGH means on.
}
Serial.print(x);
delay(4500);
}
Serial.println();
}