Outils pour utilisateurs

Outils du site


issue118:python

Ceci est une ancienne révision du document !


Before we get too far along, there is a new version of the Arduino IDE (1.8.0) available at https://www.arduino.cc/en/Main/Software#/?, so it would be a good idea if you download and install it before continuing. If you aren’t using your RPi for your Arduino programming, go ahead and dust it off and install the new Arduino IDE on it so you’ll be ready for next month.

This month, we’ll be controlling the Servo motor we used a few months ago on the RPi.

The Hardware

Our hardware requirements this time are very simple and you should already have everything needed: • 5 VDC Servo Motor • Arduino Uno (or clone) • Breadboard • Jumpers • 10K Potentiometer

Wiring

Once again, for our first two projects, we’ll use the same wiring/breadboard setup – even though the potentiometer is not used in the sweep program.

And for those who are interested, here’s the schematic…

Sweep

This sample code (next page, top right), and the next sample, are from the Arduino IDE Examples, so you really won’t need to copy the code. Just open the IDE, Select File | Examples | Servo. and the Sweep code. The code is already well documented, so we won’t need to discuss much about it.

Plug in your Arduino, upload the code to it, and you’ll see that the servo starts sweeping back and forth.

Knob

Just as in the sweep program, the example code is found in the Arduino IDE under File | Examples | Servo | Knob. And again, the code is very well documented already, so no major discussion will be needed.

Again, pull up the code in the IDE, upload it to your Arduino, and when you turn the potentiometer, you should see the servo swing in response to the position of the potentiometer.

As I said earlier, next month we will be working with the Raspberry Pi to control the Arduino, so break it back out, and get ready.

issue118/python.1488276433.txt.gz · Dernière modification : 2017/02/28 11:07 de auntiee