top of page
Search

My journey through a 6-day robotics workshop.

  • hisuijade9232
  • 8 hours ago
  • 5 min read

Day 1:

On day 1, I used Arduino INE to program an Arduino UNO to make certain LEDs to flash at different timings. This code makes it look a little bit like a loading bar which also changes color.

Code

const int ledRed = 13;

const int ledYellow = 12;

const int ledGreen = 11;

const int ledCyan = 10;


void setup() {

pinMode (ledRed, OUTPUT);

pinMode (ledYellow, OUTPUT);

pinMode (ledGreen, OUTPUT);

pinMode (ledCyan, OUTPUT);

}

void loop() {

digitalWrite (ledRed, HIGH);

delay  (100);

digitalWrite (ledRed, LOW);

delay  (100);

digitalWrite (ledYellow, HIGH);

delay  (100);

digitalWrite (ledYellow, LOW);

delay  (100);

digitalWrite (ledGreen, HIGH);

delay  (100);

digitalWrite (ledGreen, LOW);

delay  (100);

digitalWrite (ledCyan, HIGH);

delay  (100);

digitalWrite (ledCyan, LOW);

delay  (100);

}

Day 2:

On this day, I did not use the Arduino UNO or the INE but I made two circuits.

The first one was a power supply connected to a switch, leading to a normal resistor, then a ammeter and back.

The second one was the exact same other than the fact that I used a variable resistor (a resistor which the resistance can be manually changed) instead of a normal resistor.

(Both images shown at the bottom)

Day 3:

Luckily, I did use the Arduino this day. In fact, I did 3 little projects.

The first was making a fraction of the famous Tetris theme tune, using the buzzer.

The second was using the Ultrasonic sensor and displayed it on the serial monitor.

The third was combining those together, making a buzzer which makes a different pitch of sound by the distance detected by the Ultrasonic sound.

Code 3

const int buzzer = 3;

const int trigPin = 10;

const int echoPin = 9;

long duration;

int distance;

void setup() {

  pinMode(buzzer, OUTPUT);

  pinMode(trigPin, OUTPUT);

  pinMode(echoPin, INPUT);

  Serial.begin(9600);

}

void loop() {

  digitalWrite(trigPin, LOW);

  delayMicroseconds(2);

  digitalWrite(trigPin, HIGH);

  delayMicroseconds(10);

  digitalWrite(trigPin, LOW);

  duration = pulseIn(echoPin, HIGH);

  distance = duration * 0.034 / 2;

  Serial.print("Distance: ");

  Serial.println(distance);

  int freq = distance * 20;

  tone(buzzer, freq);

}

Code 2

const int trigPin = 10;

const int echoPin = 9;

long duration;

int distance;

void setup() {

  pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output

  pinMode(echoPin, INPUT); // Sets the echoPin as an Input

  Serial.begin(9600); // Starts the serial communication

}

void loop() {

  digitalWrite(trigPin, LOW);

  delayMicroseconds(2);

  digitalWrite(trigPin, HIGH);

  delayMicroseconds(10);

  digitalWrite(trigPin, LOW);

  duration = pulseIn(echoPin, HIGH);

  distance = duration * 0.034 / 2;

  Serial.print("Distance: ");

  Serial.println(distance);

}

Code 1

const int buzzer = 3;

const int E = 330;

const int B = 247;

const int C = 262;

const int D = 294;

const int A = 220;

int noteON = 350;

int noteOFF= 20;


void setup() {

  pinMode(buzzer, OUTPUT);

}

void loop() {

  tone(buzzer, E);

  delay(noteON);

  noTone(buzzer);

  delay(noteOFF);

  tone(buzzer, B);

  delay(noteON/2);

  noTone(buzzer);

  delay(noteOFF/2);

  tone(buzzer, C);

  delay(noteON/2);

  noTone(buzzer);

  delay(noteOFF/2);

  tone(buzzer, D);

  delay(noteON);

  noTone(buzzer);

  delay(noteOFF);

  tone(buzzer, C);  // start buzzing

  delay(noteON/2);

  noTone(buzzer);

  delay(noteOFF/2);

  tone(buzzer, B);

  delay(noteON/2);

  noTone(buzzer);

  delay(noteOFF/2);

  tone(buzzer, A);

  delay(noteON);

  noTone(buzzer);

  delay(noteOFF);

  tone(buzzer, A);

  delay(noteON/2);

  noTone(buzzer);

  delay(noteOFF/2);

  tone(buzzer, C);  // start buzzing

  delay(noteON/2);

  noTone(buzzer);

  delay(noteOFF/2);

  tone(buzzer, E);

  delay(noteON);

  noTone(buzzer);

  delay(noteOFF);

  tone(buzzer, D);

  delay(noteON/2);

  noTone(buzzer);

  delay(noteOFF/2);

  tone(buzzer, C);  // start buzzing

  delay(noteON/2);

  noTone(buzzer);

  delay(noteOFF/2);

    tone(buzzer, B);

  delay(noteON*1.5);

  noTone(buzzer);

  delay(noteOFF*1.5);

  tone(buzzer, B);

  delay(noteON/2);

  noTone(buzzer);

  delay(noteOFF/2);

  tone(buzzer, D);

  delay(noteON);

  noTone(buzzer);

  delay(noteOFF);

  tone(buzzer, E);

  delay(noteON);

  noTone(buzzer);

  delay(noteOFF);

  tone(buzzer, C);  // start buzzing

  delay(noteON);

  noTone(buzzer);

  delay(noteOFF);

  tone(buzzer, A);

  delay(noteON);

  noTone(buzzer);

  delay(noteOFF);

  tone(buzzer, A);

  delay(noteON*2);

  noTone(buzzer);

  delay(noteOFF*2);

  delay(740);

}

Day 4:

On this day I finally was taught how to turn a DC motor with a transistor using an Arduino

Code

void setup()

{ pinMode(13, OUTPUT);

}

void loop() {

digitalWrite(13, HIGH);

delay(1000);

digitalWrite(13, LOW);

delay(1000);

Day 5:

This day was filled with boards containing Arduino-s and transistors.

Firstly, I made a motor spin omnidirectional and with different speeds.

The funnest part yet, I made a car with no consciousness.

Code



 
 
 

Comments


bottom of page