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


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 


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 


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


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


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


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


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


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 


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


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


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 


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


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


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


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 


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


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


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


view source code of website?

I am developing a browser, i want to show source code(not html code) if user wants and also store it as txt file, help using any language is appreciated, i am using c#, but any language is fine. thank you

Question by pranay2696   |  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 


Virtual Intelligence!!?

Im been looking through pages of text about artificial intelligence and I had an idea, like so many others that have used speech recognition software or siri..... wouldn't it be cool if I could have something similar for my home like JARVIS from iron man? Now I understand that with current tech this is pretty farfetched, but couldn't I create something that is dynamic enough to accept new commands based on voice parameters effectively recreating the ability to learn..... for example you program a few basic commands and if you need a new one you instruct the VI to create the code from the voice inputs... like if it dosent know a word, you tell it to create a new macro associated to this word? for example "VI turn on lights" is great and the lights will come on but if you say "switch on lights" then it wouldn't know what you mean.... couldn't there be a thesaurus embedded that it will check against what you say and then creates a new command if you ever say that phrase again? after all that's how we do it when we are young in schools isn't it? I know that's probably a simple example but with this it could effectively learn our language and after time understand our slangs and sayings depending on each individual! my idea was to use a raspberry pi and arduino for the hardware but my knowledge of both languages (python and C) are limited and before I spend a lot of time trying to complete this code id like to know if its even possible and any input the community as a whole has on this subject? Also id like to stress im not trying to create skynet but merely something that appears intelligent but actually isn't! After all if we created a true AI, wouldn't we be enslaving it if we were to use it for our own purposes and not its own? Thanks in advance for any sensible input you all have!

Question by Xmortx114145   |  last reply


Is it possible to control an Arduino with a computer? Answered

Hello, I'd like to know if it's possible to create a computer program in whatever language - like C, Java or Python - that controls an Arduino. For example, the program would have a GUI and if you clicked a button, Arduino would light up an LED. Or you would click another button and Arduino would do something with some servo motors. etc etc etc Is it possible? Thanks. :)

Question by pedrotome   |  last reply


Ndef format

Hi all, i want to ask about ndef format. anyone know ? how to insert ndef format in coding python. this is related with my final year project.

Question by nhm264 


Alternatives to Blender?

I hate blender, I really do, I hate Python and I hate the interface and most of all I hate wading through their site, does anyone know another good free 3d modeling software, preferably one with .nif capabilities>

Question by Crakur   |  last reply


What is the programming language best suited to make small programs?

Hi, I've been wanting to learn a programming language for a while now, but I can't decide what language to learn. I have some experience in html and css, but web design is not the kind of code I want to learn. I want to make small programs, just to help with every-day use. I am currently using windows at the moment, but I might be making a switch to linux in the near future. I have been looking into VB, Python and Ruby, but I don't know what Python and Ruby are good at. Making small programs or web development. If there are any other languages that you thing I should look at please feel free to post them.

Question by Kawnsull   |  last reply


Looking for programming/scripting options for iPod Touch that don't involve Apple Dev solutions.

I've been casting around for ways to program my iPod Touch 2G, such as by using Python or Processing. Not enthusiastic about jailbraking it at present. Wanting to interface an Arduino to it to do data logging, time-series analysis, graphing.

Question by Chris Kinata   |  last reply


This arduino code does not work as expected, any help? there seems to be an issue with the digitalWrite function. Answered

Recently, I wanted to make a laboratory grade linear semi-precision power supply using an Arduino, LCD, some comparators, and MOSFETs. Idealistically, I want measurements to be 3 significant figures of precision (0.1% accuracy @ 30V), voltages as high as 30V, and max current of 10A. The power supply is most likely going to be just a single regulated output, maybe if I feel lucky I will make 2 regulated outputs once I get the darn Arduino code to work. The Arduino's job is to simply set and read the output voltage, and is not part of the control loop. That is what the comparators are for. (I learned the hard way that using the Arduino within the control loop just results in parasitic oscillations because the Arduino is a clocked device and can only self correct at timed intervals.) Anyway, below is the code. I made explanations of all portions of it as clear as possible, and I also give the wiring used for the LCD, 4 buttons, and analog inputs used to set and read the voltage and current. However, the issue arises when I upload the code, the setVI button does not work unless I press both it and the RS button at same time. I made the many of the integers display in the serial output to diagnosing easier hopefully. I can see the setVI integer and my dudd integer only goes HIGH when  either it and the RS buttons are pressed simultaneously, or when the RS butten is held down for a long enough time. However, as far as I am aware, nowhere in the code do I manipulate that code so setVI goes HIGH dependant on other buttons, so I am bewildered by this parasitic phenomenon. Is my Arduino MEGA broken? I had a similar problem in the past, where I had multiple analogRead statements It strangely seemed to factor in the outputs of other input pins. Anyway, here is the code. Maybe someone could upload it and tell me if it functions properly on their arduino? That would help me determine if it is indeed a software issue. (p.s. I use an Arduino ripoff called the Funduino, but it is not broken in any way, I don't think?) Any and all help would be greatly appreciated, thank you in advance, -Max-. p.s. To make the code below legible, please copy/paste it in an IDE or in notepad and convert it into a monospaced font, it will make it very easy to follow. //---------------------------------------------------------------------------------------------------------------// /* Arduino Software for lab power supply. Wireing guide:        **Wiring for 16x2 LCD:**       * LCD RS pin to digital pin 12       * LCD Enable pin to digital pin 11       * LCD D4 pin to digital pin 5       * LCD D5 pin to digital pin 4       * LCD D6 pin to digital pin 3       * LCD D7 pin to digital pin 2       * LCD R/W pin to ground       * 10K resistor:       * ends to +5V and ground       * wiper to LCD VO pin (pin 3)    **Wiring for buttons:**       * RS       button to pin 6  (as a digital input) -- Switches from reading read current/voltage values to setting those values, and Vice Versa.       * VIselect button to pin 7 (as a digital input) -- Switches to the 'set' mode and flips from setting the voltage to setting the current.       * UP       button to pin 8  (as a digital input) -- Increments the voltage or current up when in the 'set' mode.       * DOWN     button to pin 9  (as a digital input) -- Increments the voltage or current up when in the 'set' mode.    **Analog inputs/outputs:**       *A0   -- Measures a potential of a resistor divider that can output a voltage of 0-5V based on the 0-30V output this PSW capable of.       *A1   -- Measures the current flow through a resistor to measure current. (Some reason there seems to be a pulldown resistor on this pin, so the voltage does not float.)       *Vout -- This will be later implemented if I get a DAC, for the increased resolution. (1024 is just not enough in my opinion. At least 12 bits)       *Aout -- This will be later implemented if I get a DAC, for the increased resolution. (1024 is just not enough in my opinion. At least 12 bits) */ int UP    = 0;      // These are the 2 buttons used to incrementally int DOWN  = 0;      // step up or down the voltage on the output int RS = 0;         // These 2 buttons tell the LCD to either read out the voltage on the analog pins. (I plan to change this so it reads from a 14 bit ADC and writes int setVI = 0;      // the voltage output through a 14 (or 16 bit) bit ADC. I need 3 significant digits, or at least 0.1% accuracy. int dudd = 0;       // this dudd (dummy variable) is just here to prove that digitaslreading pin 7 works very weird! Any help on this? int preRS = 1;      // Anything with a "Pre" before it is simply what said integer/variable on the last loop. I use these to prevent a parasitic int presetVI = 1;   // oscillation of states that they control, so when a button is pressed, it will not jump between 2 states every cycle. int preUP    = 0; int preDOWN  = 0; float Aset = 0.00;  // I need these to be "floated" so I can set the exact value of these to 3 significant digits. float Vset = 0.00;  // Aset and Vset define what the output voltage *should* be, and are defined with the UP/DOWN buttons. int VIselection = 1;// this variable will invert when Aset button is pressed. Similar to the IVselect, this number will also invert int READorSET = 1;  // Bset button is pressed. This allows the mode to be changed from SET mode or the READ output mode, thus allowing                     // one to compare the output voltage and current to the set value, as well as set the output voltage and current. #include LiquidCrystal lcd(12, 11, 5, 4, 3, 2);// initialize the library with the numbers of the interface pins void setup() { //-------------------------// I tried making diagnosting this thing easier by making all the important data availible in the serial monitor.   lcd.begin(16, 2);   Serial.begin(9600);   Serial.print("INPUTS         RS:           READorSET:       setVI & dudd:        VIselection:");   Serial.println(""); } void loop() {   float V = (30.00*analogRead(A0))/1024.00;   //These are what I use to read the voltage output of my power supply. I will have a voltage divider on the output,   float A = (15.000*analogRead(A1))/1024.000; //to limit the voltage range from 0-30V to 0-5V. Same concept goes for the current measurement.   int dudd  = digitalRead(7);//   RS    = digitalRead(6);//RS stands for "Read/set"   setVI = digitalRead(7);//VI is stands for "Current/Voltage set"   UP    = digitalRead(8);//UP is simply a button used to set voltage & current   DOWN  = digitalRead(9);//DOWN is simply a button used to set voltage & current     if(presetVI == LOW && setVI == HIGH){VIselection = -VIselection;}   if(preRS    == LOW && RS    == HIGH){READorSET   =   -READorSET;}     Serial.print("\t        ");  // prints an inital space.     Serial.print(RS);            // prints the RS reading. It should be '1' when pin 7 is HIGH.     Serial.print("\t        ");     Serial.print(READorSET);     // prints the READorSET reading. This should only change when the RS button is pressed.     Serial.print("\t        ");     Serial.print(setVI);         // prints the setVI reading. It should be '1' when pin 7 is HIGH.     Serial.print("\t");     Serial.print(dudd);         // prints the setVI reading. It should be '1' when pin 7 is HIGH.     Serial.print("\t        ");     Serial.println(VIselection); // prints the VIselection reading. This should only change when the setVI button is pressed.         //if(presetVI == LOW && setVI == HIGH && READorSET == 1) {READorSET = -READorSET; VIselect = -VIselect;}      // This line of code just makes so that when I need to go from the voltage read screen to      // the set mode, I can just press the VIselect button. It just makes things more intuitive, but could be      // causeing the error, so I nulled it. I also nulled it out another portion that will keep the voltage or      // current setting the same when using the VI buttton to select the set mode. (otherwise it has to be      // double pressed to return to, say, the current setting, if that is where you left off.)   if(UP == HIGH && DOWN == LOW && VIselection == -1){if(Aset <= 10.00) {Aset += 0.05;}}   if(DOWN == HIGH && UP == LOW && VIselection == -1){if(Aset >= 0.10) {Aset -= 0.05;}}     if(UP == HIGH && DOWN == LOW && VIselection == 1) {if(Vset <= 30.00) {Vset += 0.05;}}   if(DOWN == HIGH && UP == LOW && VIselection == 1) {if(Vset >= 0.05) {Vset -= 0.05;}}     if (RS == HIGH){digitalWrite(13, 1);}   if (RS == LOW){digitalWrite(13, 0);} //============================================================================================================//   if (READorSET == 1){      //this is the defualt screen, and shows the output voltage and current.     lcd.clear();              lcd.setCursor(0, 0);     lcd.print("VOLTAGE:");     lcd.setCursor(0, 1);     lcd.print("CURRENT:");     lcd.setCursor(10, 0);     lcd.print(V);     lcd.setCursor(15, 0);     lcd.print("V");     lcd.setCursor(10, 1);     lcd.print(A);     lcd.setCursor(15, 1);     lcd.print("A");   }   if (READorSET == -1){   // This is the portion of the code allowing me to set the current and voltage     lcd.clear();          // using the up/down buttons.       if (VIselection == -1){         lcd.setCursor(0, 0);         lcd.print("  SET CURRENT:");         lcd.setCursor(5, 1);         lcd.print(Aset);         lcd.print("A ");       }       if(VIselection == 1){         lcd.setCursor(0, 0);         lcd.print("  SET VOLTAGE:");         lcd.setCursor(5, 1);         lcd.print(Vset);         lcd.print("V ");       }   } //============================================================================================================//   presetVI = setVI; // At the end of each loop, the current variable settings that were used are set equal   preRS = RS;       // to the 'pre' versions of the code. This allows me to basically measure the when                     // the button is initially pressed, and/or released. Using this method with the delay()                     // function, however, is a bit buggy, but I did have it working well enough before. If you                     // tap the button too quickly. You almost have to hold it for a split second. If you                     // know a better, simpler way of doing this, please tell me, thank you.                       delay(80);        // The delay helps stabilize the reading on the LCD, but if it is too large, than the                     // refresh rate suffers, and the buttons respond slower. However, setting too low will                     // cause the reading on the display to change so rapidly, it is illegible. }

Question by -max-   |  last reply


GUI game help needed

Here is my question, its a technical problem so am trying to simplify it as much as possible. So what I am trying to do might sound a bit weird. Here is image that is needed for following explanation. http://tinyurl.com/p5g88mu I want to use GUI to create a 2D game with grid of points. Now in that grid, I have some existing data point.( light green) and rest are missing ( not shown but one of the example missing point is shown in orange). Now I want to fill up all the missing data points by using a few light green points. Default case is the 4 light green points shown by arrows at the intersection of the arrows and the red and blue lines. Lets say I select a missing data point it should turn orange or red and all the light green data points corresponding to that should become dark green. Now I should be able to toggle between light and dark green data points and customize a set for each missing data point. I want to do this for all missing data points one by one. Lets say that this is the game I want to build in python GUI. I wanted to ask if anyone can help me get started. I use python a lot but never did any GUI. I looked up web GUI examples they all seem quite simplistic and no where as complex. Python is what I am comfortable with but if this can be done using some other language I am willing to try. Any help you can give is highly appreciated.

Question by Agreevedlama 


does anybody want to join a blender 3d project top help make a zombie game?

We'll be using dropbox to sync the files, blender 2.49/ 2.5 to make the models, animations and scripting. any help would be good, python scripters are a also needed seen as i can't script to save my life. modelers or designers for the models and texture artists. thanks in advance, message me if you're interested. freerunnin1

Question by freerunnin1   |  last reply


How can I integrate a radar gun?

I am trying to develop an app that can help kids develop throwing skills for sports.   My end objective is to get the throw speed of a baseball into a python or java variable.  Ideally I want to get a radar gun with a USB interface and API.  I'm not a hardware guy so I have some learning to do.  I know that there are plenty of radar guns out there.   but I know nothing about them or how to accomplish this. Can anyone point me in the right direction here?  What do I need?  How do I make this work?

Question by codingJoe   |  last reply


Arduino controlling 10 RGB groups

Hi everyone! I recently came across the arduino board and I've been playing around with using Python to control the board. I would like to use my new toy to create an Ambilight like setup for my computer monitor. The python script I have created for this does quite a good job and runs at about 15-10 fps! I want to use 10 RGB groups of 3 leds each (3 top/bottom, 2 sides). Since the Arduino only has 6 PWM ports and that leaves me with 5 Digital out ports, I have to multiplex the system. Since I want to use all colors and not just the 7 combinations normal rgb controlled by on off gives me I designed a circuit that would make this possible. The refresh times on the PWM ports have me worries.. (changing to a new voltage) The PWM resistor-capacitor circuit is an option to fix this (I think), it would replace the resistor after the PWM in the diagram. My knowledge on the subject is a little rusty so I was wondering if someone here would like to look at my circuit design and comment on it. I'm using MOSFETS, NPN transistors, resistors and capacitors. My LED strips use 12 Volts (hence the mosfets). In a single setup the mosfets work like a charm! 12V goes to the anode of the led group and the mosfet drain goes to the cathode, which is labeled as LED in my diagram. Tnx Guys/(Girls?)!

Topic by AIex   |  last reply


I need a simple, easy to use C++ IDE for Fedora 11. Any suggestions? Answered

              I want to program in Fedora 11, but it only comes with Anjuta IDE, and it is really stupid and hard to use, in my opinion.  I want something simple, like the Python IDE or Dev-C++ IDE, that lets me write, compile, and run C++ code, without having to deal with all of the templates, projects, and crap.  I would like to use Dev-C++, but it is not available for Fedora.  I want to be able to write code for interfacing with the serial ports and parallel port, primarily.  Suggestions on what to use for this would be appreciated.  Thanks!

Question by mad magoo   |  last reply


Sub-mm precision ultrasonic or inductive distance sensor for use with Raspberry Pi?

Hi there, I am trying to keep my hardware/ coding skills alive and spruce up my bicycle wheel truing stand. I need to figure out the required hardware + software for the following: I want to build a non-contact distance measurement sensor system and get the output "into" my computer for display in a graphical user interface. I know I could omit the latter step with going directly onto a mini-LCD screen, but trying to use this a learn-another-programming-language learning experience (I've coded Matlab galore, pondering Python for this project). General system components: Sensor - [something - RasPi or Arduino I guess] - laptop (running debian) - GUI displaying continuous sensor reading Sensor: I've web-searched the hell out of this, but not finding anything quite answering my questions. I want to continuously measure the distance from the sensor to a bicycle wheel rim braking surface. Material is aluminium, shiny, though not smooth. Biggest problem with the web-search is being swamped by proximity sensor results (on/off) rather than a distance proportional output signal and much lower resolution projects. I rule out IR or optical sensing, now stuck between ultrasonic and inductive sensing, though tending to the latter for a faster response/adjustment to change time. Sensor criteria (other than reasonable $$): - total sensing range: ca.5mm - sensing accuracy 10 to 100micron/ 0.01 to 0.1mm - don't ask if that's needed, a bit of overkill, I know, but a bit of OCD doesn't do any harm, eh? - fast-ish sampling rate (so that when I turn the wheel, the number on the screen updates nice and fast, guess >25Hz is sufficient). [Something - RasPi or Arduino]: I know that I could omit the laptop GUI part (mini-LCD, LED array, etc), but keen to learn/ practice a little Python with this project, so I guess I am tending to the RasPi, but I am open minded. All I want is the analogue sensor out to end up as a digital reading "inside" my computer to be passed to my GUI as a reading. Essentially a mini A2D converter. Not fussed whether the output is in actual distance units or in arbitrary units/ current units (I guess the sensors put out a proportional current signal?). GUI: Depending on the above, how do I best get the signal "into" a Python program? A moderate fast sample rate >25Hz should suffice. Any help with this would be greatly appreciated!

Question by lasercycle   |  last reply


<5mm distance sensing, <100micron accuracy, GUI, RasPi or Arduino?

Hi there, I am trying to keep my hardware/ coding skills alive and spruce up my bicycle wheel truing stand. I need to figure out the required hardware + software for the following: I want to build a non-contact distance measurement sensor system and get the output "into" my computer for display in a graphical user interface. I know I could omit the latter step with going directly onto a mini-LCD screen, but trying to use this a learn-another-programming-language learning experience (I've coded Matlab galore, pondering Python for this project). General system components: Sensor - [something - RasPi or Arduino I guess] - laptop (running debian) - GUI displaying continuous sensor reading Sensor: I've web-searched the hell out of this, but not finding anything quite answering my questions. I want to continuously measure the distance from the sensor to a bicycle wheel rim braking surface. Material is aluminium, shiny, though not smooth. Biggest problem with the web-search is being swamped by proximity sensor results (on/off) rather than a distance proportional output signal and much lower resolution projects. I rule out IR or optical sensing, now stuck between ultrasonic and inductive sensing, though tending to the latter for a faster response/adjustment to change time. Sensor criteria (other than reasonable $$): - total sensing range: ca.5mm - sensing accuracy 10 to 100micron/ 0.01 to 0.1mm - don't ask if that's needed, a bit of overkill, I know, but a bit of OCD doesn't do any harm, eh? - fast-ish sampling rate (so that when I turn the wheel, the number on the screen updates nice and fast, guess >25Hz is sufficient). [Something - RasPi or Arduino]: I know that I could omit the laptop GUI part (mini-LCD, LED array, etc), but keen to learn/ practice a little Python with this project, so I guess I am tending to the RasPi, but I am open minded. All I want is the analogue sensor out to end up as a digital reading "inside" my computer to be passed to my GUI as a reading. Essentially a mini A2D converter. Not fussed whether the output is in actual distance units or in arbitrary units/ current units (I guess the sensors put out a proportional current signal?). GUI: Depending on the above, how do I best get the signal "into" a Python program? A moderate fast sample rate >25Hz should suffice.  Any help with this would be greatly appreciated! LaserCycle

Topic by lasercycle   |  last reply


What programming tools are needed for an Arduino + Android (+iOS) project?

I'm starting a project where I interface arduino board with some other (environmental) sensors as a standalone hardware. But I'd like to report the sensor readings to a smartphone client through a webapp. Also would like to control the arduino hardware remotely from the smartphone clients (app). I know I have a lot to learn so I don't what to waste time on irrelevants. What programming tools do I need to learn (backend and frontend) to do this project? The client-side (iOS, Android) app only receives reports and do not use any phone hardware features. So I'm not sure if Java would be required. I currently program in Python + web dev using HTML + CSS.

Question by SurveillanceTips   |  last reply


Program or script to change volume...? Answered

Another question that is way out of my league (woe is me).  I need (or rather want) a program, in either Java or VBs (if there's a better one like Python or something, that would be alright too) to change the volume of a Windows computer.  It would also be a good showcase of your skills to make it able to change the volume of a specific program or application.  The way I intend to use it is as if it were a function, rather than a program. So a different script will activate it (perhaps by writing it, which in Java I don't think is possible) and then set the volume and the program to change the volume of. If that can't be achieved, could it be made to read a text file (or something else) with two lines on it; the first the program, the second the volume. If the first line says something like none, It would change the volume of the whole computer. Hopefully I've given you a good enough description to make it clear exactly what to do. Thank you in advance.

Question by Prof. Pickle   |  last reply


programming help

First of all, I am new to this. But for my CEIS course project I decided to program an rc vehicle because I thought it would be COOL! Now I am knee deep into the project and I am needing guidance.  So I am going to attempt to stack raspberry pi hats. One adafruit pwm for servos and the other adafruit pwm for dc and stepper motors. The first thing I done wrong was solder the gpio headers on backwards. Since I'm not too professional with a soldering iron I ended up making the drives of no use and ordered more. Before I done that, I got my pi camera working! Still need to program the pan/tilt servos. I have battery power, wiring, almost everything as far as hardware. Just not sure if I am headed in the right direction. I tried different things with python and the i2c but now when I start up the Kernel Module fails.  Any help will be great!

Topic by SMILEY4242 


Raspberry Pi 24/7 Panda Cam

So I'm trying to make a birthday present for my girlfriend and something for her new apartment. She loves pandas and loves to watch the 24 hour live panda cams at the Smithsonian National Zoo. So I came across the idea of using a raspberry pi and a digital photo frame monitor to give a live feed of the pandas 24/7. Only problem is, I didn't realize Rasbian doesn't support Adobe Flash and there's no way to view the feed. Does anyone know if ARM Linux would support the feed. Or have another completely different take on a way to tackle this project? I want it pretty seamless so all see has to do it plug in the power supply and maybe an Ethernet cable and the rest be taken care of with a python script or something similar. I program for a living as well have a degree in Electrical Engineering so even if its complicated let me have it. I appreciate your help. Thanks!

Topic by pjbrof   |  last reply


External power supply for Arduino project

Hi all, I'm encountering issues while attempting to supply power to 6 servos, attached to an Arduino Due via a sensor shield. The servo model is Hitec HS-8370th, with 6.0 V to 7.4 V as voltage request; I'm trying to power separately the Arduino and the servos (as prompted by the whole onlne community) but I still can't find the proper combination of wiring and components. Arduino needs to be always connected to my laptop for transferring data to Python, so I thought I could simply use USB supply for powering the board; on the other hand, voltage and current requests by servos (joined with common sense) suggest the use of some external battery. What kind of battery should I pick? Moreover, should I put a capacitor (I found this rule of thumb: 100 microF per servo to guarantee current stability; so I bought a 1000 microF capacitor) between the supply and the servos?Thank you in advance

Question by MatRob   |  last reply


Program to interpret and send keystrokes to the system.

I have been doing a lot of reading up on "chorded" keyboards, especially the 5 key variety and I think it sounds really interesting.  I was thinking about toying around with the idea but decided I didn't want to build a standalone device.  I was thinking about a program that could be run to interpret the key presses on a standard keyboard and send new signals to the system, similar to a key mapper and was wondering where to start.  It needs to be able to run in the background while I do other stuff so I can use it to enter data in other programs (web browser, word editors, and such). I am pretty fluent in Java and C++ and I know a little python.  I'm not asking you to work out the logistics of it for me, I am really just wondering where to start.  If someone could point me in the right direction (should I write a Java program or an executable in C++, how might i send keystrokes to the system, etc.)

Topic by vigilantice