Thursday, February 19, 2015

Robot Club - fifth session completed


Full house this week.

Link to Fourth Session: http://winkleink.blogspot.co.uk/2015/02/robot-club-forth-session-completed.html

Full house and I  think everyone was ready for half-term.
A lot more boisterous and distracted than early on.

From the Preparing Blog post we were working with the line following sensor.

Line following sensorhttp://ebay.to/1wXWDKI£1.195£5.95

The weekend before I did some work with this sensor and rather than reflecting different amounts of infra-red light depending on the colour of the surface it is more responsive to changes in effectiveness. So, a matt black surface to a shiny white surface gives the highest contrast and so gives the best reading.
The sensor also has a very limited analogue range and really is a digital switch. Meaning if the contrast is large enough it returns a HIGH signal.

With this knowledge we discussed inputs and how up until now we have only been doing outputs. Sending signals from the Arduino to the motors, with no information coming from the robot to the Arduino.  So, we have no idea if the robot is bumping into things.

Using the whiteboard we went through the operation of the sensor and how to wire it up. VCC, GND Out. We wired it to Digital Pin 2.

Modified the code to add a pinMode(2, INPUT) to the setup and an if statement in the loop() to read the pin and for this session using the Serial Monitor display a message on the computer.

It took a while to work through this as with 5 kits there was some fun with the wiring and understanding the change in the program.  

As mentioned before rather than just having the kids type in a piece of code I'm trying to worth through the logic with them so that the process is understand and not just have the ability to copy/paste.

By the end all 5 robots were reading the sensor from digital pin 2 and outputting a message to the Serial Monitor.

We now have a 3 week gap. 2 Mondays due to half-term and an inset day and I'm unavailable for the following Monday.

For the next session I will get all the code so far to the same place for each group and we will modify the code to make the robot turn around when it gets near an obstacle. It should be fun seeing 5 little robots running around the floor turning when they get near to obstacles. 





No comments:

Post a Comment

Note: Only a member of this blog may post a comment.