I’m quite new to programming world so this might be a really basic question.
Currently, I’m trying to switch on/off of LED on Arduino by using Python (pyserial).
I found some examples that require key input like on or off after running.py
That example codes actually worked with my device, but I want it without key input and couldn’t find that examples.
I mean if I run LED_ON.py, Python automatically sends on signal to Arduino and LED should be ON. Then to turn it off, close LED_ON.py and just run LED_OFF.py
Is my plan can be implemented?? 😖
Related
This is my first post. I am trying to make a drum kit using a raspberry pi. The drum triggers are some peizoelectric sensors. I have used pygame inside python to play sounds. When the script detected gpio inputs, it played drum sounds. It was fine for the most part but due to latency issues, I took another approach and decided to use puredata.
I want python to detect gpio inputs and then send signals to puredata, which will play the desired sounds.
My question is, how can I get python to send simple signals to puredata??? I am running both python and pd on the same pi.
Also, what do you think of this approach i.e. using puredata directly from gpio inputs? Can having a microcontroller like arduino to send the signals as midi signals to pd affect anything???
Thank you in advance!
I'm going back about a decade but I used Python to send data from the 3d modelling software Blender to PureData using the socket library.
This article might help a bit more with packaging up and sending across.
If you know what your components within PD are expecting as an input that will help you know how best translate your input triggers into packages to ship over socket to PD.
I am researching whether it is possible to control a NAO with a Myo Armband. I know both devices have bluetooth connects, but my question is whether certain movements in the Myo armband can be programmed with Python. Perhaps install a Python program in a computer command, so the Myo can directly control the NAO.
Has anyone attempted this or would know steps I can take to see whether this is even feasible?
The NAO can be connected via bluetooth to phones and computers and be remotely controlled that way. I've written simple movement Python code that can make the NAO move forward and backward. I'm not sure what to do next to try and take this a step further.
In Choreographe, which is the program used to control the NAO, empty script boxes still have to be opened and programmed to upload the behavior to the NAO, which is why I'm unsure how this could even be bypassed with the Myo.
I just want to see if it is possible to somehow do simple behaviors with the Myo.
Sure, it's possible. NAO v6 has integrated bluetooth, and for previous versions of NAO you could plug a bluetooth dongle in the head.
As for how to integrate it in NAO: I often use the robot-jumpstarter tempaltes, for example "pythonapp" is basically a standalone Python script wrapped in a Choregraphe package (but you can program it as if it was a python script - split your code into modules, include thrid-party libraries, etc.). Combine with the Python MYO MSDK, and you should be able to build something.
See here for a video of NAO + MYO + Occulus Rift.
I'm making a Skeeball program and boards that both work off of a raspberry pi and GPIO sensors with a tkinter gui. The first table and program is working great and now I was thinking about the possibility of adding a second table with multiplayer games.
Each pi would have to talk to each other, preferably over a LAN network instead of using I2C or serial pins. Basically I just need something mostly to pass variables from one pi to another.
My first thought was to use pickle to save to a shared network folder since I'm already using pickle to save my highscores. I just have no clue how to set up a shared folder over raspbian and I'm guessing that probably a pretty bad approach to solving the problem.
I'm also really new when it comes to python and raspbian so sorry if this problem is something super easy all I could find online was how to have a pi talk with a windows pc or an arduino.
Thanks for any help you can give me!
I am a newbie to python and I am learning new things day by day. I have a question regarding integrating wxpython and pyserial. I am writing a GUI application to control a microprocessor through pyserial.
I have a wxpython script written - displays good - with buttons and text fields.
I tested communication with my microprocessor using small commands from pyserial - everything is in good place.
Problem:
I will be having a button (say Button A) on my GUI, which after clicked - checks if the serial communication is made (by sending and receiving data ofcourse). Once the communication is good, I have to make sure the communication stays good as long as I am using my GUI. So I decided to write an external function which continuously sends and reads data (probably a for loop). Based on the functions return value I will know if my serial communication is active or not (this might be a bad idea - but thats the best I got)
Now the problem is I have a lot of other features on my GUI, buttons, text fields etc.. So for example when another button (say button B) is pressed I want to send a specific command to the microprocessor. This requires I interrupt the serial communication which was going on in my Step 1, send data from button B click, then re-start the Step 1 communication again (to keep checking my serial communication is active). I dont know how I can interrupt the communication. The Step 1 serial communication (for loop) is bound to the Button A click. Once the Button A is clicked, it goes to a for loop and serial communication is checked continuously.
I have so many buttons and text fields like this - which are going to read and write data to the Microprocessor. Whenever I want to do an event, I have to stop the serial communication in step 1 and restart it again.
On top of all this, I can only check the serial communication (mentioned in Step 1) every 100ms. I cannot just write a for loop. I have to do some modifications - like time.delay(100ms) or something.
I dont know how to frame it, but may be I just require a good algorithm idea or implement this somehow with help of import sched or import thread
I am trying majorly to avoid import thread - because my microprocessor has very minimal RAM. Also using threading with wxPython is pain in the neck (what I read online)
One of my colleagues suggested using "timer service" from my Operating system. I dont think python have a feature like that. I have no clue what he is talking about, at the least. His argument is that, if I can use this, I can run the continuous serial communication check every 100ms very easily.
Any help would be greatly appreciated. I am not looking for any complicated solutions, I appreciate if you attach a piece of code, use very basic programming. I have the wxPython GUI in a single class.
I'm currently doing a project in which I'm making an ADS-B flightradar on a led matrix, which is controlled by a Raspberry Pi. I've found a program called dump1090 which receives and decodes the data from my SDR receiver. I can find lots of example on how to use to forward that data to a webserver or whatever, but I can't seem to find anything on how you can programmatically listen to the data dump1090 produces. Does anyone know how you can programmatically receive dump1090's data in order to use the data in a program? (any language would do, but perhaps python would be the most obvious choice)
You should be able to start dump1090 using a programming language of choice (c/c++/java/python/etc.) and and read the std out pipe.
Personally, on Raspberry Pi, I find Python nicer to use since it's easier to test/reiterate without needing to compile. Python provides the subprocess package which allows you run dump1090(or any other application) from within Python and have a look at the output (using subprocess.check_output('dump1090') for example). Have a look at check_output and Popen options to see what works best with your application.