![]() Particle variable get device_name analogvalueĪnd make sure you replace device_name with either your device ID or the casual nickname you made for your device when you set it up. You can also check out this value by using the command line. (Be sure to replace your-device-ID-goes-here with your actual device ID and your-access-token-goes-here with your actual access token!) You can see a JSON output of your Particle.variable() call by going to: Pin an an OUTPUT instead of digital input. The setup() function is called once when the device boots to, well, set up the device. If you leave this out, your code won't run (and the LED will not blink) until you've connected to the network and the ParticleĬloud successfully (breathing cyan). You mostly just need to know if you add this line, your code will run immediately at startup, before connecting to the cloud. You can learn more about threading in the firmware API reference, but for now You could change the constant in this one place at the top of the file. If you wanted to use an external LED connected to D2, for example, This defines which pin we want to blink, in this case D7. They should both be okay.This code has a lot of comments, but a few things to note: I initially followed this tutorial to set up the PATH variable under the "User Variables" section. Add "C:\Python27 C:\Python27\Lib\site-packages\ C:\Python27\Scripts\ " to the "Path" variable under "System Variables". Under "Control Panel", search for "environment" to bring up the environment variable settings.Copy/paste this folder into "C:\Python27\Lib\site-packages" folder Unzip pyserial-2.7.tar.gz, in the folder "pyserial-2.7", find the folder named "serial".Download Python 2.7.10 for Windows 64-bit.With some great help from Harry, I was able to install Python and pyserial, and get them to recognize my serial port. Installing Python and Pyserial on Windows After staring at the board for quite some time and not being able to detect any points of poor soldering, I decided to replace the Attiny45 microcontroller (even though the casing looked perfectly fine) as suggested by many people who posted about this error online. I checked to make sure that none of the components looked overheated, that the RGB board was properly powered and that my programmer board was functioning. When I tried to program the board I kept on getting the "rc=-1" connection error. Similar to last week, I had to deburr the board a little bit with sand paper after milling it: I didn't have time to make an RGB LED board during the "Output Devices" week. This week I also tried to make Neil's RGB board and install Python and Pyserial on my Windows PC. Your browser does not support the video tag. ![]() The square would be blue if there was no motion and turn yellow when motion was detected.Īs can be seen in the video below, whenever there was motion, the square would turn yellow and the LED on the board would turn on:
0 Comments
Leave a Reply. |