Here I utilise the light sensor on the Circuit Playground Express to help control a model car.
Go here, Light Bot Project, to see another great tutorial from Rob Morrill
My model car looks like this:
Material and building the car issues:
Rob provides an amazon address for a continuous servos and wheels kit. I did buy that one but have since found similar materials available through adafruit (continous rotation servos, matching wheels). I'm mentioning this since, as far as I know, adafruit treats its workers far better than amazon does.
The tutorial says "Create a reinforced bottom for the front of the robot" but doesn't stress that this could be done to increase the surface area for attaching the servos by cutting notches that match the ones on the chassis. Doing that would strengthen the wheel attachments.
I bought heavy duty velcro from Bunnings (holds 3 kg) for attaching the CPX and battery to the car.
Coding issues
Rob claims that the CPX Slide Switch acts like a forever loop when moved left (always checking). I didn't find this to be true so I abandoned use of the Slide Switch and used a forever block instead.
The car in the tutorial has an awning. The plan is that when it approaches a wall the shade produces less light and this is used to trigger a reverse and turn. I found this too fiddly because light varies within a room and different times of the day. So, instead I reversed the approach and coded so the car goes forward in "normal" light and then shine a torch on the sensor when it approaches an obstacle to put it into reverse.
Here is my modified code, with some comments attached:
And here is a short video of the light bot in action:
Salton Sea statistics
-
I wanted to gain better insights into the Salton Sea level, evaporation,
inflows and outflows. Step one was to gather publicly available data about
its lev...
57 minutes ago
No comments:
Post a Comment