Adventures in Minecraft by David Whale

Adventures in Minecraft by David Whale

Author:David Whale
Language: eng
Format: epub, pdf
ISBN: 9781118946855
Publisher: Wiley
Published: 2014-11-01T09:59:13+00:00


Finding the Serial Port Number

The Arduino you have just connected to your computer appears to the computer as a device called a serial port. I won’t go into the details of what that means in this book, but you do need to make sure that the anyio package selects the correct port before it will work as a GPIO extender.

I have written a little utility to do this for you, and it is included in the anyio package. Figure 5-5 shows a sample session using this utility, so you can see what it should normally look like.

To make sure the correct port is selected:

Open IDLE and click File⇒Open to browse for an existing Python program.

Inside the MyAdventures folder, open the file called findPort.py and it will load into the Python editor window.

Run the program by choosing Run⇒Run Module from the menu. You will get some onscreen instructions.

Unplug the USB lead from the Arduino end, then press Enter to start the scan. This step removes the USB lead from your computer so that the program can scan all available ports in your computer and build a list of any ports except the new one you are adding.

Next you will be asked to plug in the device so that the program can scan all available ports in your computer again, and use that to detect which new device has been added. Plug in your USB lead again, wait a couple of seconds, then press Enter again.

If this has been successful, you should get a message indicating the port name or number that has been found, and you should be asked if you want to remember this. Type a Y then press Enter. The findPort.py program (shown in Figure 5-5) then creates a file called findport.cache that remembers the port number of your Arduino. When you use any of the GPIO functions later it will be able to find the Arduino port correctly.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.