The forums are retiring and are now closed for new topics and comments. The existing content will remain online and accessible through 2020 to provide everyone the opportunity to save any relevant information. In the spring of 2021, these Community forums will be taken offline.

Search for Python in Topics


Arduino - Python GUI

Hi all, I'm using arduino for a while now. For my purposes I was using matalb to communicate with it. I want to move to python now. I started building my first python gui to control my arduino program. The problem: I'm trying to pass a sentence which contains python's entry values to arduino, but for some reason the arduino doesn't read it. The codes are written here. Arduino code #define LED 13 void setup() {   pinMode(LED, OUTPUT);   pinMode(2,OUTPUT);   Serial.begin(9600); } void loop() {   if (Serial.available()) {     char c = Serial.read();     if (c == 'H') {       digitalWrite(LED, HIGH);       digitalWrite(2,HIGH);     }     else if (c == 'L') {       digitalWrite(LED, LOW);       digitalWrite(2,LOW);     }   } } Python code from tkinter import * import serial import time ser = serial.Serial('com7', 9600)  # com7 need to be changed for linux ^%&*^$%&$%&$%^&###@@@ time.sleep(0.2) # ser.close() print('serial communication started') def pent(ard):     s = entry1.get()     c = bytes(s, 'utf-8')     ard.write(c)     time.sleep(0.5)     # ard.write(b'H')  # the b before 'H' is conversion to bytes. needed for arduino.     print("LED ON")     time.sleep(0.5)     ard.write(b'L')     print("LED OFF")     time.sleep(0.5) root = Tk() RTitle = root.title("LaserOdorPython") root.minsize(200, 200) root.maxsize(1400, 850) root.geometry("300x500") label1 = Label(root, text='Odor#\Laser', font=11) entry1 = Entry(root) label1.place(x=10, y=20, width=90, height=20); entry1.place(x=120, y=20, width=90, height=20) button1 = Button(root, text='single pulse', font=8, command=lambda: pent(ser)) button1.place(x=100, y=140, width=90, height=30) root.mainloop()  

Topic by torr.polakow  


Monty Python recommendations? Answered

We are re-making Monty sketches as a tribute to Grahm Chapman. Any suggestions for classic sketches from Flying Circus?

Question by RedneckAsian    |  last reply


Command parsing in Python?

I am currently attempting an Interactive Fiction game in Python (when I am finished I plan to write an instructable detailing how I did it). The only problem I have run into is the parser. I want to be able to specify a syntax for a command, and have the parser be able to recognize when the command is being input regardless of the arguments passed to it, as well as be able to extract the arguments from the inputted command. This would not be so much of a problem if there were not both one-argument and two-argument commands, and the fact that "throw x to y" is a different command than, say, "throw x at y". Any help would be greatly appreciated.

Question by dungeon runner    |  last reply


Practical uses for Python and JavaScript?

I was just wondering about the sort of things you can do with these two.  I know you can use at least JS when building webpages, but I don't really enjoy that sort of thing when I code.  Are there other uses for these?  Also, is it true that robots can be programmed with Python?  Thank you very much for an answer.

Question by StarscreamClone    |  last reply


Recommendations on Python GUI tools

Heya everybody; Just got permanently done with schoolin', and now that I have free time again I'd like to start making some slicker interfaces for some of the open-source design tools out there (for PCB design, CAD, FEA). I know its an ambitious project; but its a long-term goal. Tried a couple different programming languages, and so far Python seems like the most flexible and powerful. Figure I should start messing around with GUI libraries. So the question: Which of the myriad options would you recommend for GUI creation from Python? The end result I am going for is something along the lines of the computer screens in "Iron Man" series, preferably with support for vector graphics. Example of the desired style shown below. Suggestions/advice? Also, anyone interested in collaborating on this, let me know!

Question by daedalus12    |  last reply


Building a replica Colt Python?

I just built a small CNC machine to add to my workshop and was wondering if anyone has the build plans for a colt python. I would like to build an all wooden 1:1 scale replica, swing out cylinder and all. I spent hours scouring the Internet, and have found nothing of a suitable quality. So, anyone got a .dxf file(s) I can work with, or at least some accurate drawings I can take measurements from? Thanks in advance.

Question by MrMystery96    |  last reply


Coding help (python/Adafruit)

I am making a pair of boots that have a series of LEDs running in a “U” shape up and down the back of them, the plan is to make them light up with pressure sensors In the heel. I’ve taken components from several tutorials to make the circuit but now I am realizing that’s going to make it impossible to just copy and paste the code (with only a few minor changes) from any of them. I’m trying to learn python but I learn best from doing (with knowledgeable help). I will pay someone whatever hourly rate they think is fair to walk me through how to edit a prewritten code (unless it’s easier to start from scratch) to work with this project. I’ve listed below the materials I am currently planning on using in the circuit WS2812B LED chips With Black PCB Heatsink (10mm3mm) WS2811 IC Built-in 5050 SMD RGB DC5V, 0.3w/led, 3 channel, color order is grb, not rgb- link listed below https://www.amazon.com/gp/aw/d/B01DC0J3UM?ref=ppx_pt2_mob_b_prod_image Adafruit flora LiPo 3.7v 1200mAh battery Conductive thread On/off button Velostat

Question by heather.walls  


Help with annotate function in python

Hi everyone I'm trying to plot live data on Python from an arduino through the serial port. I found some difficulties with annotate function. I don't know how to configure it or whether the place where I have put annotate function is it the the right place or not For example: for every point in temperature, i want the value to be printed next to the point ? this is my python code import serial # import Serial Library import time #import time import numpy  # Import numpy import matplotlib.pyplot as plt #import matplotlib library from drawnow import * temperature= [] vitesse= [] charge= [] current= [] Time = [] arduinoData = serial.Serial('com5', 9600) #Creating our serial object named arduinoData plt.ion() #Tell matplotlib you want interactive mode to plot live data cnt=0 ##fig1 = plt.figure() STARTINGTIME = round(time.time(),2) def makeFig(): #Create a function that makes our desired plot     plt.subplot(2,2,1)     plt.subplot(2,2,1).annotate(str(temperature)+','+ str(Time), textcoords='offset points')     plt.title('Live Streaming Temperature Sensor Data')     plt.ylabel('Temperature C')     plt.grid(True)     plt.plot(temperature, 'ro-')     plt.subplot(2,2,2)     plt.subplot(2,2,2).annotate(str(vitesse)+','+ str(Time), textcoords='offset points')     plt.title('Live Streaming Speed Sensor Data')     plt.ylabel('Speed KM/H')     plt.grid(True)     plt.plot(vitesse, 'bo-')     plt.subplot(2,2,3)     plt.subplot(2,2,3).annotate(str(charge)+','+ str(Time), textcoords='offset points')     plt.title('Live Streaming SOC Sensor Data')     plt.ylabel('Battery Charge %')     plt.grid(True)     plt.plot(charge, 'go-')     plt.subplot(2,2,4)     plt.subplot(2,2,4).annotate(str(current)+','+ str(Time), textcoords='offset points')     plt.title('Live Streaming Current Sensor Data')     plt.ylabel('Current A')     plt.grid(True)     plt.plot(current, 'yo-') while True: # While loop that loops forever     while (arduinoData.inWaiting()==0): #Wait here until there is data         pass #do nothing     arduinoString = arduinoData.readline() #read the line of text from the serial port     dataArray = arduinoString.split(';')   #Split it into an array called dataArray     temp = float (dataArray[0])     vite = float (dataArray[1])     char = float (dataArray[2])     curr = float (dataArray[3])     temperature.append(temp)                     #Build our temperature array by appending temp readings     vitesse.append(vite)                     #Build our vitesse array by appending temp readings     charge.append(char)                     #Build our charge array by appending temp readings     current.append(curr)                     #Build our current array by appending temp readings     Time.append(round(time.time(),2) - STARTINGTIME)     drawnow(makeFig)                       #Call drawnow to update our live graph     plt.pause(0.00001)     cnt=cnt+1     if(cnt>50):         temperature.pop(0)         vitesse.pop(0)         charge.pop(0)         current.pop(0)

Topic by SoufianeG  


Monty Python episodes in HiQ on YouTube

. Monty Python is making most of their videos available at http://www.youtube.com/user/MontyPython.

Topic by NachoMahma    |  last reply


is it possible to program my BS microcontroler with python? what else can python do?

My computer science teacher was wanting to buy a set of robots. the boe-bot and the scribbler bot. All of us are really skilled in java. could they be programmed with that? He's more or less appointed me as his adviser to this venture, and i'd like to hear frome someone who's had some experience I'm also an arduino freak and i was wondering if python could have anything to do with that.

Question by mikemmcmeans    |  last reply


What is the best book for learning Python and C++?

I want to learn python and C++ but I want a couple of good books to learn those with. What books do I need if I want to start?

Question by nerd7473    |  last reply


How to get the properties from a file with python

I need to know how to see if files(like .txt files) are empty with python and how to create new files(like the ones you store pics and .txt files in) and how to move files(like .txt) into the files you just created Thanks in advance for any answers!

Question by FastLearner    |  last reply


How to use python to make a random generator? Answered

 How do i make a random generator with parameters using python? My goal is to use python to tell me what t-shirt to wear. but  i don't want to wear the same shirt more than once a week.  I figure you're allowed to make brain processing light in the morning :P btw i'm a beginner so i want to learn but still get the product.

Question by Houdinipeter    |  last reply


is it possible to create a program that can learn with Python? Answered

i want to create a simple program that can be told information and learn from it, also i want the program to be able to respond to questions asked of it about the things it knows does anybody know where to start?

Question by Psychic Master    |  last reply


Raspberry Pi: Launch Python Script on Startup

Hello sir, Running Python script at boot works fine with crontab, only thing is that I am stuck to it. How to come out of it ?How to stop it. Cntr+C does not work

Topic by dgkanade72    |  last reply


sea sponge to raise humidity for a ball python? Answered

I have a ball python and i am trying to raise the humidity in his tank, i have a large water dish over a UTH and i have paper over half of the mesh top (quick fix, i need to get plastic wrap). i would mist his tank, but i am not home enough to do it consistantly,  would putting a piece of sea sponge sitting in a dish of water be healthy or would it be detrimental to Howard's health?

Question by .happy.hippie.    |  last reply


Advice on preparing/presenting a Python Master Class?

I am preparing a master class to present to a group of Technical Artists# at work. Everyone in the group has previously programmed in C/C++/MEL/MAXScript/Python. The purpose of the class is to collectively bring everyone's skill levels and technical understanding on variety of Computer Data Science topics to a common level.I would like some advice as this first time I've delivered such a class. I am planning on structuring the course to be two 2 hour sessions, with 30 minute blocks of content interspersed with Q&A;, code-review, and individual assistance. I know this a multi-part question, so don't feel you need to be able answer everything, just contribute what you can. Any links to articles, SO questions, or reflection on personal learning experiences is greatly appreciated. Questions/Advice/Links to Further Reading- What CS topics should I attempt to cover?- Examples of other Python training courses? - What do you wish someone taught you when you first started programming?- Python programming best-practices- Tips for delivering technical content to creative/artist audience? Using Dive Into Python as a textbook and referencing the MIT Open Courseware Introduction to Computer Science on Academic Earth. I have also been given a 2 minute overview on adult training (Malcolm Knowles), i.e., working the students through the cycle of: identify the problem, determine the cause, researching a solution, and applying.

Question by emmablisa    |  last reply


why python script run command two times? resolved

Hi  I start to program my raspberry pi 3  I a new in python world and I don t understand  the goal of my script is to start application or script on key event like if b is press start blu.py (my robot program) the problem is when I close the script or the application , it restart a second time; so I close it again and It s done. I don t understand why the script run a second time the command when I close it? I hope my english is not to bad I am french thanks

Question by LaurentP30    |  last reply


in python im trying to make a program that loops but still can delete things as well.the code will be in the bottom.?

#Date:3/24/16 #creator:Ry   and    Er  #function:Equedity Sticks import random import time theNames=["Ri","Sc","Br","Jo","Ch","An","Wl",           "Ry","Ju","Gr","Me","Er","Je","Ry","De","Ga"] classRoster=random.randint(1,16)                 if classRoster==1:                 print("Ro has been picked!") if classRoster==2:                 print("Sc has been picked!") if classRoster==3:                 print("Br has been picked!") if classRoster==4:                 print("Jo has been picked!") if classRoster==5:                 print("Ch has been picked!") if classRoster==6:                 print("An has been picked!") if classRoster==7:                 print("Wi has been picked!") if classRoster==8:                 print("Ry has been picked!") if classRoster==9:                 print("Ju has been picked!") if classRoster==10:                 print("Gr has been picked!") if classRoster==11:                 print("Me has been picked!") if classRoster==12:                 print("Er has been picked!") if classRoster==13:                 print("Je has been picked!") if classRoster==14:                 print("Ry has been picked!") if classRoster==15:                 print("Ga has been picked!") if classRoster==16:                 print("De has been picked!") userNotDone=True while userNotDone:     counter=1     for things in theNames:         print(counter, things)         counter=counter+1     x=input("Which student would you like to remove?")     del theNames[int(x)-1]     theAnswer=input("Are you done removing studnets Y or N")     if theAnswer=="Y":         userNotDone=False i want it to loop where it picks the name AND where it deletes the names because i would like to have a finished program and i wont be able to get help from my teacher untill next week but this isnt really for a project grade, i just would like to have a working code and one that is just broken taking up space

Question by RyanK84  


how should i learn python online course???

Please suggest to me which is best source to learn python online course??

Topic by srikanth420    |  last reply


What is the purpose of "self" when creating classes in python? Answered

I can't find any good explanations on the internet, so can someone explain why it's needed and where to use it?

Question by Shagglepuff    |  last reply


read and right a text file through batch in python

Ok so I have a - batch file named run.choice.bat  - text file named choice.txt - text file named python.txt - and a python file named choice.py The batch file contains this code: @echo off set /p c=<"choice.txt" echo %c% choice /c:%c% echo %errorlevel% echo %errorlevel% > python.txt pause The python file contains this code: def choice(keys="yn"):     """Choice.com"""     import os     import time     o = open("choice.txt", "wb")     o.write(keys);     time.sleep(1)     os.system("run.choice.bat")     i = open("python.txt", "r+")     errorlevel=int(i.read(2))     return errorlevel choice(raw_input("choice(")) my problem is that the batch file wont read choice.txt while running in python, on its own it runs fine. can somebody help me fix it?

Question by FastLearner    |  last reply


can't get python script working in blender 2.59

Hello, I'm using blender for some time now but I still don't understand how to run python scripts. I've installed the version of python which was used to compile blender (3.2)but I keep getting errors when I run a script like irrb(http://irrlicht.sourceforge.net/forum/viewtopic.php?t=27073 ) has someone got a clue of what I do wrong? thanks

Question by selujtje    |  last reply


can't get python script working in blender 2.59

Hello, I'm using blender for some time now but I still don't understand how to run python scripts. I've installed the version of python which was used to compile blender (3.2)but I keep getting errors when I run a script like irrb(http://irrlicht.sourceforge.net/forum/viewtopic.php?t=27073) has someone got a clue of what I do wrong? thanks

Topic by selujtje  


How to fix this python program? Please any advice!

I'm testing 'Arduino and Raspberry Pi Powered Pet Monitoring System'. Now I'm facing error on step 15. Ican't run python program. The error message is attached below. Someone please advice me! Because it's important for me. Thanks

Question by Htet Yan    |  last reply


How can I solve "ModuleNotFound" error in Python?

Hello everyone! Although I installed firebase "ModuleNotFoundError: No module named 'firebase' is showing as error msg; How can I fix Thanks

Question by Htet Yan    |  last reply


all right, i am trying to find a way to write a PYTHON program that can learn from what it is told? Answered

i also wish the program to be able to reply to questions asked about the facts it is told... any suggestions where i should start? 

Question by Psychic Master    |  last reply


Arduino code, that can text my phone with? Answered

Is there a way to write some code that can text my phone? will have to be connected to python? do i need a ethernet shield? please HELP!!!!

Question by Artix Vetraga    |  last reply


Control software with WebIOPi?

Hello everyone, I have been trying to interface ServoBlaster on my pi, and have ran into an issue. I am a a beginner with Python, and so that may be the reason, but what my issue is: I can't find/figure out how to write a script for controlling software! All i find is how to control GPIO Pins via a python script for WebIOPi. With all the looking i have done, i haven't seen a guide, tutorial, or project involving interfacing software. All i find is how to write a program for the pins themselves, and not a command. What i would need to do, is instead of turning on or off a pin, the python script would run a command.  So, how would i write a script in python for WebIOPi that doesn't make a GPIO pin high or low, but instead runs a command such as 'echo P1-12=120 > /dev/servoblaster'? 

Question by RocketPenguin  


Instructables pong help?

I have been thinking about this for a long time: An insctructables version of pong.  I would like some help with it possible positions include: -Someone to download a bunch of famous instructablers profiles (Like lemonine and fungus amungus and kiteman (probably spelled all of their names wrong)) -A Java programmer to help me make an android and/or iphone/ipad app out of it. -A couple python programmers because the main language im going to do it in is python. -Possibly graphic designers. If you have any interest leave a comment or send me a message or an owl or a pigeon or use your preferred method of communication.

Topic by octopuscabbage    |  last reply


Does anyone use kivy?

Does anyone on instructables use kivy? I am wondering if people use kivy, and if they do can they tell me how they like it? Please comment.

Question by DELETED_bertwert    |  last reply


raspberry pi digital dimmer of light bulb

Hai, iam working on dimmer light project with raspberry pi the module which iam using from research design lab issues with the device to test or run it. please any one can suggest me can i change the module to wifi based dimmer module to test or run the light dimmer. thank u

Topic by james2jain  


pi coders wanted

Looking for a few coders to help make a better 3d system based on the pi and arduino. apps available will incclude: 3d printing tool usage CNC 3d scanning and more to come I have next to NO experience in coding but have designed and tested 2 machines that I need programmers for. these will be opensource at the end and also sellable. I am hoping to make a store similiar to playstore or app store so that advanced programmers can also make a small amount for exceptional products. the idea is huge but could be beneficial to several thousand people including users of this forum in helping them with techniques and skills they have not yet mastered. the project is HUGE and the mechanical side is largely done with the exception of a few parts that are added extra. other inclusions will be safety features and high perfomance. for those that are interested in this AND have coding experience I look forward to your replies on this topic

Topic by plucas1  


I got a snake (Ball Python)! I want tips

I just got a Ball Python. I got him on Saturday, August 14. I decided to name him monster. He is a very very calm (probably scared) snake. Considering snakes are somewhat new to my family, I want tips on how to care, and train my new snake. I have uploaded pictures.

Topic by Flumpkins    |  last reply


How do I get a Python script to work in Blender?

I am using Blender quite extensively right now, and I would like to be able to import and export md5 models. Unfortunately, Blender does not do this natively, so I had to find and download a Python script. That's when the trouble started. I am new to Python, so I have no idea where to properly place the scripts and how to run them. After some searching, I believe I located the correct folder: Blender/contents/MacOS/2.57/scripts Within this folder are 5 folders. They are as follows: -addons -modules -presets -startup -templates There is also a python folder in the 2.57 folder which contains a library for scripts, but I believe these are for python itself rather than Blender. The files I am trying to install are as follows: -blender2md5_v0.94-sauer3.py -md5-0.5.py -md5Import_0.5.1.py I tried opening each of these in terminal to attempt to 'install' them, but got this message: File "/Applications/blender-2.57-release-OSX_10.5_i386/blender.app/Contents/MacOS/2.57/scripts/modules/md5Import_0.5.1.py", line 33, in import Blender ImportError: No module named Blender (I did not include some command lines because they contain my name and my computer's name.) What am I doing wrong? Where do I put these files? Is there something wrong with the filenames? Do I have to do anything fancy to get them to run in Blender? Any help is appreciated! I am running Blender 2.57 on Mac OSX v. 10.6.7 

Question by AlternateLives    |  last reply


Use python or Iot To draw an entire floor system of conveyor

Hello everybody, I am working on a project idea and would like some input from the community. the goal of this project is to be able to use a tote that will a smart one. so we will use a "smart tote". the goal of the "smart tote" is to reproduce the entire conveyor system that exist in any given building. let say we will put the tote on the fisrt conveyor and as the tote is going down the lane I want to be able to retrace it on my computer as a drawing following its step along the way. does anybody could suggest the best way to do that. I would like to use python and integrate some data science technique as well( but that I could figure out).Thank you,Martial

Question by akogho1    |  last reply


How can I simulate keystrokes/ keyboard input in Python?

Over the course of a few weeks, I have been programming a robot (called a Finch), to respond to commands from a Wii remote. I planned to use a raspberry pi to run the code so i could make it more mobile. I wrote a program in Java that lets me control movement with the arrow keys, and other keys like A, S, D, Q, W, R, F, J, K, L, M, do other things like change the LED color or make it say something. After I finished that, I wrote some python code that uses the CWiid library. I tested the code on the pi, and it works, its just that I don't know how to use it to send input that my Java program can use.

Question by jgdabble  


Would some one PLEASE write me a VERY basic python code? Answered

I have been very thoroughly FAILING at learning python, everything i can find on it is either far out of my league or doing something completely different than what i need THIS is what i need A single square button that when pressed sends a bit of "1" over serial to an arduino uno nothing fancy,just a skeleton script allowing me to do that and HOPEFULLY figure this whole button concept out and please, if you do decide to help me, please comment on the  various lines just  briefly telling what they do, so many of the codes ive looked at arn't very descriptive in their commenting.

Question by shabaki    |  last reply


Resource: instructable monitor bot command line app

Hi all, If you are looking for a way to be notified when one of your instructables gets a spike in more views, I wrote couple different python command line apps for that exact purpose. The first displays a visual notification, speaks and announcement, and plays a beep whenever your tutorial gets X more views. You can customize X. The second uses email notifications instead of text to speech. The third command line app lets you customize the notification ringtone. Hope you find this useful! There'a a full tutorial here:  https://www.instructables.com/id/Instructable-Hit-Announcer-Bot/

Topic by Maker Saga  


Messages From Raspberry pi

Hello Everyone,I am trying to use my raspberry pi to send messages via the internet to my phone. What I want to know is, if it is possible without using any cellular connection or services like twilio? I want to do it over the internet.Please help me with this.Cheers

Question by Bhabeshr  


Axis value to angle conversion

Hello all,So I have been trying to convert the values obtained from pygame joystick value (ranges from -1 to 1) and convert it to angles between 0 to 180 to drive servo motors. Can someone help me with this cuz I have no idea how to do it. Thanks in advanceCheers.

Question by Bhabeshr    |  last reply


Raspberry Pi 3 Interactive Led Strip Wall

At the moment we're working on an interactive led screen wall for the entrance hall of our new studio. I've setup the following frame (http://i66.tinypic.com/33ll30j.jpg)  with 17meters of WS2812B addressable led strips.We're using the Neopixel library for rasp (https://github.com/jgarff/rpi_ws281x) and it works like a charm with the rasp 3. Anyway they next step is to control these ledstrips so they work as one big display. I had a look on the internet and a lot of people advices to work with the FadeCandy from Adafruits but I want to know if there are other solutions using only Python and write software to control the ledstrips. The purpose is to use the rasp's camera module like this guy did http://andydoro.com/ledmirror/images/stills/ledmirror01.jpg so when someone is entering the room, his reflection appears on the wall... Any information / tips / other solutions about how to achieve what I described above are welcome. Thanks

Topic by Fightbean    |  last reply


problem with annotate()

Hi im trying to plot live data on python from an arduino through the serial port  i found some difficult with annotate function i don't know how to configure the third parameter (position) python code import serial # import Serial Library import time #import time import numpy  # Import numpy import matplotlib.pyplot as plt #import matplotlib library from drawnow import * temperature= [] vitesse= [] charge= [] current= [] Time = [] arduinoData = serial.Serial('com5', 9600) #Creating our serial object named arduinoData plt.ion() #Tell matplotlib you want interactive mode to plot live data cnt=0 ##fig1 = plt.figure() STARTINGTIME = round(time.time(),2) def makeFig(): #Create a function that makes our desired plot         plt.subplot(2,2,1)     plt.subplot(2,2,1).annotate(str(temperature)+','+ str(Time), textcoords='offset points')     plt.title('Live Streaming Temperature Sensor Data')     plt.ylabel('Temperature C')     plt.grid(True)     plt.plot(temperature, 'ro-')     plt.subplot(2,2,2)     plt.subplot(2,2,2).annotate(str(vitesse)+','+ str(Time), textcoords='offset points')     plt.title('Live Streaming Speed Sensor Data')     plt.ylabel('Speed KM/H')     plt.grid(True)     plt.plot(vitesse, 'bo-')     plt.subplot(2,2,3)     plt.subplot(2,2,3).annotate(str(charge)+','+ str(Time), textcoords='offset points')     plt.title('Live Streaming SOC Sensor Data')     plt.ylabel('Battery Charge %')     plt.grid(True)     plt.plot(charge, 'go-')     plt.subplot(2,2,4)     plt.subplot(2,2,4).annotate(str(current)+','+ str(Time), textcoords='offset points')     plt.title('Live Streaming Current Sensor Data')     plt.ylabel('Current A')     plt.grid(True)     plt.plot(current, 'yo-')     while True: # While loop that loops forever     while (arduinoData.inWaiting()==0): #Wait here until there is data         pass #do nothing     arduinoString = arduinoData.readline() #read the line of text from the serial port     dataArray = arduinoString.split(';')   #Split it into an array called dataArray     temp = float (dataArray[0])     vite = float (dataArray[1])     char = float (dataArray[2])     curr = float (dataArray[3])     temperature.append(temp)                     #Build our temperature array by appending temp readings     vitesse.append(vite)                     #Build our vitesse array by appending temp readings     charge.append(char)                     #Build our charge array by appending temp readings     current.append(curr)                     #Build our current array by appending temp readings     Time.append(round(time.time(),2) - STARTINGTIME)     drawnow(makeFig)                       #Call drawnow to update our live graph     plt.pause(0.00001)     cnt=cnt+1     if(cnt>50):         temperature.pop(0)         vitesse.pop(0)         charge.pop(0)         current.pop(0)

Topic by SoufianeG    |  last reply


compiling code?

I have written several scripts and simple games in python 2.7.2, and would like to give them to friends so they can play them. however, they do not have python, and therefore cant run it, so I need to compile the code. the only problem is, i cant figure out how or to compile it or to get any compiler to work. any help would be appreciated! thanks,            iloveairsoftstuff

Question by the mechanical engineer  


Calibrate Compass

I have compass cmps-12 and i want to use it or calibrate it with my raspberry pi 3 using python. I already check on website but im not find it how to make it work. Please anyone knows how to calibrate compass cmps using python on raspi3 i need your help. :(

Topic by alharis    |  last reply


Can an old smartphone be repurposed?

Hello and my heartiest greetings to all reading this,I have this old Nokia Lumia 540 and was wondering whether I could replace the OS with something like the Raspbian to use it with python and utilize all the cool stuff already there in the phone. Is that sort of thing possible?I am totally new to this stuff and hence have no idea about any of it. Please help me out.Cheers. :)

Question by Bhabeshr    |  last reply


Making a Computer butler, What should it do?

I am making a Computer Butler in Python I Know how to program it I just need to know what other people would like a computer butler to do for them. note: when I say "Computer Butler" I mean a program on your computer that you tell what to do and it does it for instance: Master: Hello Butler how are you Hello master I am good, Thank you Master: can you open a file for me Of coarse, What file would you like to open?  Master: Chrome (Chrome opens) thank you all in advance for any answers. Once my butler is finished I will try to make a instructable on making it

Question by FastLearner    |  last reply


PD Control of Ball and Plate System (Stewart Platform) via Python and Arduino

Hi community,I'm prototyping a 6-DOF Stewart Platform, i.e. a parallel mechanism also known as hexapod, with an embedded resistive touchscreen on its top plate that captures the current position of a ball moving on it. Coordinates are stored by Arduino Due and sent via serial to a Python script which elaborates data, computes inverse kinematics and outputs the 6 servo angles (again via serial port) to Arduino that, finally, moves the arms. As you can notice, velocity is obtained by a one-side differentiator and here it comes my first question: how much should be the sampling step? It takes 124 microseconds for Arduino to execute both the "AnalogRead" functions, but coordinates are stored in Python at a different clock (order of one millisecond). I picked sampling step h (see attachment 2) equal to the computational time of the Python script, with decent results, but still I'm not convinced.My second issue regards tuning of the PD controller: I first described the system with a double-integrator transfer function (from assumptions and simplifications over ball&plate; control) but the obtained controller parameters were far from the optimal ones. Therefore a simplified model of motor dynamics was added to the transfer function and new PD constants were implemented: simulation and real behaviors are far from being identical (high delay, not null steady-state error, higher rise time, etc.); however, inside small ranges of error and with reduced velocity, the ball reaches an equilibrium basin. The third attachment depicts the final transfer function where:- K is K_m*K_ball*g (K_m:motor gain constant, K_ball: ball inertia, g: gravitational force)- T is tau_m: motor time constant;I set K_m and tau_m equals to torque (Kg*m) and velocity (rad/s) respectively, according to servomotors datasheet: is this the right choice?Thanks to everyone for even reading and for any upcoming help.

Topic by MatRob    |  last reply


Bluetooth shutter button for Raspberry Pi Camera

Hi everyone, I'm fairly new to coding on a raspberry pi and would like some help with an issue I am having.I am currently using a raspberry pi to view a live preview of the pi cam directly onto a screen. I would like to link the Pi to a Bluetooth button such as the flic button, so that when pressed, it would take an image using a python script. I have installed the flic SDK for Linux and have detected and connected to the button to view it's MAC address. I am unsure of how to proceed after this to allow the button to interact with a python script, so my question is what is the best way to proceed to do what i'm trying to achieve?. Any help would be much appreciated.

Question by Matt Delaney  


Anyone here use pygame? Check out this game I made.

Pygame is a python module that makes it easy to make games. I made pong game and a Patriot command remake. The pygame home page is http://pygame.org. My Patriot command home page is http://patriotcommand.yolasite.com and http://www.pygame.org/project-Patriot+Command-1394-2708.htm Im looking for some feedback on the game you need python and pygame installed in order to play it in a little while I will upload a app that works on intel macs 10.5 and up. The source works on macs and pcs and should work with linux computers also. Has anyone else made a pygame. I attached the source in a 7-zip archive.     At the title screen press enter to start a game. Enter will take you from any screen to the next. I cant upload the mac version because it is 14mb and instructables doesn't let you upload more than 10.

Topic by Tanners    |  last reply