Sie sind auf Seite 1von 17

Welcomes You To

Workshop on Arduino
DAY - II


ROBOT WITH
Problem Statement #1

 Build Robot which can follow a Square


Track.

 It should stop at the corner it started.

 Sensor should be placed on the outside of


the Square track.
Clues:
 Clue 1
 millis():
Returns the number of milliseconds since the Arduino
board began running the current program.
Syntax: time=millis();

 Clue 2
 Modify Line follower code by adding time based logic.

 Clue 3
 Time taken to reach Line is greater at corners.

 Clue 4
 The robot should follow the outer edge of the track.
PWM
(Pulse Width Modulation)
Pulse Width Modulation
 There are 3 PWM pins available on the
Arduino Board – Pins 9,10,11.

 PWM values range from 0 to 255.

 Values from 0 to 255 are mapped onto


values from 0V to 5V.
Analog Function
 analogWrite():
Writes an analog value (PWM) to the specified pin. The
pin will generate a steady square wave of the specified
duty cycle

Syntax: analogWrite(pin, value);

Parameters:
pin: the pin to write to.
value: the duty cycle: between 0 (always off) and 255
(always on). [8-bit]

Note: analogWrite() DOES NOT need pinMode() to be


set in initialization.
CIRCLE DRAWING
ROBOT
Problem Statement #2

Build a robot which can track a


circle of a given radius.

(The radius of the circle is measured with


respect to the inner wheel.)
Clues:
Clue 1:
Inner Circle (Ic) = 2∏r
Outer Circle (Oc)= 2∏(r+x)
Where x = robot width

Clue 2:
Ic / Oc = r /(r + x)

Clue 3:
Speed = d / t
d1 / d2 = Ic / Oc
INTERRUPTS
Interrupts
attachInterrupt(interrupt, function, mode)
Interrupt:
0 for pin number 2
1 for pin number 3

Mode:
LOW
RISING
FALLING
CHANGE

Function:
Is the switching function that is called when interrupt is triggered.
SUMO Robot
Competition
Rules & Regulations:
 Robot should stay in the arena at any
instant of time.
If not, you will be disqualified.

 While moving around within the arena the


robot should move at 60% of its
maximum speed.

 Whenever the robot bumps onto the


opponent, it should move at 100% speed
and push the opponent out of the arena.
Clues:
 Use IR sensor to detect the boundary of
the arena.

 Use Bump Switch to detect the opponent.

 Use PWM to obtain variable speed.


 Thank You 

Your feedback is important for us.


For any queries contact:

Jayasurya Dutt
js@li2-innovations.com
9951234593

Das könnte Ihnen auch gefallen