Show Posts
|
|
Pages: [1] 2 3 ... 7
|
|
1
|
Community / Local Groups / Tacoma Makers group
|
on: January 03, 2013, 10:42:45 am
|
Hey, I just wanted to let you guys in the arduino forum know about the Tacoma Electronic Makers group that has been meeting in Tacoma for a few years. We are a small group and would love to expand, so why don't you join us? We meet on the second Sunday of each month at FabLab Tacoma. Signup to our mailing list or get connected on facebook through our website: www.tacomamakers.comOur next meeting is on the 13th at 1:30.
|
|
|
|
|
2
|
Using Arduino / Programming Questions / Cannot use the ArduinoISP to program attiny85.
|
on: January 20, 2012, 06:02:11 pm
|
I am trying to use my Arduino Duemilanove to program a Attiny 85 microcontroller. I am running Arduino on my Windows 7 Toshiba laptop. I have done this before with a DIP in Arduino version 0022 but cannot seem to get it to work now. I followed this tutorial: http://hlt.media.mit.edu/?p=1706I connected all the pins (PWR, GND, SCLK, MISO, etc...) to the appropriate arduino pins and to the attiny through a header on the board it is affixed to. I double checked all the connections but still cannot get the chip to program. I tried to program it from arduino 0022 and 1.0 but to no avail. The ISP programming sketch uploads fine but when I try to upload the code to the attiny this is the error message I get Arduino 1.0: Binary sketch size: 818 bytes (of a 8192 byte maximum) avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85 avrdude: stk500_program_enable(): protocol error, expect=0x14, resp=0x50 avrdude: initialization failed, rc=-1 Double check connections and try again, or use -F to override this check.
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51
If someone could point me to a solution I would be greatly appreciative. -Peter
|
|
|
|
|
3
|
Using Arduino / Interfacing w/ Software on the Computer / Python/Arduino interfacing issue.
|
on: September 10, 2011, 09:40:29 pm
|
|
I have a sketch on my Arduino sending an analog pin value to the computer through serial.println.... It is working fine. I am trying to read that value through python using the PySerial library. My python code is this: import serial ser = serial.Serial('COM4', 9600) while 1: ser.readline() When I put the code in a line at a time through the python shell it works but if I try to run it from a saved file (F5) it gives me this error: Traceback (most recent call last): File "C:\Users\Peter\Dropbox\3D printer\Python Interface.py", line 2, in <module> ser = serial.Serial('COM4', 9600) File "C:\Python27\lib\site-packages\serial\serialwin32.py", line 30, in __init__ SerialBase.__init__(self, *args, **kwargs) File "C:\Python27\lib\site-packages\serial\serialutil.py", line 260, in __init__ self.open() File "C:\Python27\lib\site-packages\serial\serialwin32.py", line 56, in open raise SerialException("could not open port %s: %s" % (self.portstr, ctypes.WinError())) SerialException: could not open port COM4: [Error 2] The system cannot find the file specified.
I am running the code on a win7 64 bit Toshiba laptop running win7 ultimate 32 bit. Python verision 2.7.2 Thanks in advance, Peter
|
|
|
|
|
4
|
Community / Exhibition / Gallery / Re: Arduino Pocket Ossiliscope
|
on: May 07, 2011, 09:46:39 am
|
Well cr0sh I agree with you on that. In the next version I would like to have dual trace and have better time info. Perhaps even some memory features. @Onions: Using the library I have (also on my website peterdavenport.posterous.com) it is really simple to write code for the screen. LCDSetLine(45, 5, 21, 130, BLACK); Is basically the form all the screen commands are in with the numbers being ordered sets of the x and y positions of the object to be drawn. The library takes care of the LCD protocol stuff.
|
|
|
|
|
7
|
Forum 2005-2010 (read only) / Troubleshooting / Cant convert sring to float.
|
on: March 28, 2009, 01:14:46 pm
|
I am trying to convert a string constructed by the textstring library into a float. String xstr = String(10); ... float xwantedpos = float(xstr); Serial.println(xwantedpos); ...
I get this error message: error: invalid cast from type 'String' to type 'float'how can I convert these types of strings to floats/doubles.
|
|
|
|
|
9
|
Forum 2005-2010 (read only) / Troubleshooting / Pyserial help
|
on: January 30, 2009, 07:49:30 pm
|
|
I am trying to recognize incoming signals coming from my arduino in pythion. I have this code : import serial ser = serial.Serial('/dev/tty.usbserial', 9600) while 1: ser.readline()
But I get this error message:
Traceback (most recent call last): File "C:/Documents and Settings/ad/Desktop/test", line 2, in <module> ser = serial.Serial('/dev/tty.usbserial', 9600) File "C:\Python25\lib\site-packages\serial\serialutil.py", line 171, in __init__ self.open() File "C:\Python25\lib\site-packages\serial\serialwin32.py", line 53, in open raise SerialException("could not open port %s: %s" % (self.portstr, msg)) SerialException: could not open port /dev/tty.usbserial: (3, 'CreateFile', 'The system cannot find the path specified.')
So any ideas of how to make it work?
|
|
|
|
|
11
|
Forum 2005-2010 (read only) / Syntax & Programs / Problem with greater than or equal to.
|
on: May 06, 2009, 04:26:31 pm
|
I am making a G-code interpreter and have run into an issue in the positioning system. This code works, but the stepper I am using isn't acreate down to 0.01 mm: void xSmall(){ if(abs( xCurrent - xDouble ) <= 0.005){ //do nothing!!! }else{ if(xCurrent < xDouble){ //Do we move up? //Move tward xDouble by 0.01 units digitalWrite(x1, HIGH); delay(d); digitalWrite(x1, LOW); digitalWrite(x2, HIGH); delay(d); digitalWrite(x2, LOW);
digitalWrite(x3, HIGH); delay(d); digitalWrite(x3, LOW); digitalWrite(x4, HIGH); delay(d); digitalWrite(x4, LOW);
xCurrent = xCurrent + 0.01; //write in current location }else{ //Move tward xDouble by 0.01 units digitalWrite(x4, HIGH); delay(d); digitalWrite(x4, LOW); digitalWrite(x3, HIGH); delay(d); digitalWrite(x3, LOW);
digitalWrite(x2, HIGH); delay(d); digitalWrite(x2, LOW); digitalWrite(x1, HIGH); delay(d); digitalWrite(x1, LOW);
xCurrent = xCurrent - 0.01; //write in current location } } }
This code compensates for the inacreasy but is Doesn't work: void xSmall(){ if(abs( xCurrent - xDouble ) <= 0.25){ //do nothing!!! }else{ if(xCurrent < xDouble){ //Do we move up? // Move tward zDouble by 0.25 mm digitalWrite(x1, HIGH); delay(d); digitalWrite(x1, LOW); digitalWrite(x2, HIGH); delay(d); digitalWrite(x2, LOW);
digitalWrite(x3, HIGH); delay(d); digitalWrite(x3, LOW); digitalWrite(x4, HIGH); delay(d); digitalWrite(x4, LOW);
xCurrent = xCurrent + 0.25; //write in current location }else{ // Move tward zDouble by 0.25 mm digitalWrite(x4, HIGH); delay(d); digitalWrite(x4, LOW); digitalWrite(x3, HIGH); delay(d); digitalWrite(x3, LOW);
digitalWrite(x2, HIGH); delay(d); digitalWrite(x2, LOW); digitalWrite(x1, HIGH); delay(d); digitalWrite(x1, LOW);
xCurrent = xCurrent - 0.25; //write in current location } } }
I don't see any logical reason why it wouldn't work? :-?
|
|
|
|
|
15
|
Forum 2005-2010 (read only) / Syntax & Programs / If statement seeming to not work?
|
on: April 22, 2009, 05:22:55 pm
|
I am writing a G-code interpreter and have run into a problem. When the X and Y axis get to their desired position (Right now I just have it return the axis and a .01 unit movement over serial) they just move +0.01 and -0.01 back and forth. How can I get it to stop it when it reaches the desired position? #include <WString.h> // include the String library String inString = String(50); // allocate a new String for the incoming group of chars. String units = String(2); // allocate a new String for the units setting. Inches or Milimeters. String xstr = String(10); // string for the X caricters to be dumped before thy become and double or float. String ystr = String(10); // string for the Y caricters to be dumped before thy become and double or float. String zstr = String(10); // string for the Z caricters to be dumped before thy become and double or float. double xCurrent = 0; double yCurrent = 0; double zCurrent = 0;
double xDouble; double yDouble; double zDouble;
double xDiference; double yDiference; double Diference;
void setup() { Serial.begin(9600); // open the serial port Serial.println("start"); // Say hello } void loop () { if(Serial.available() > 0) { //add chars if they are avalible char inChar = Serial.read(); // read the incoming data as a char if (inChar == 'l'){ // If it is the end of the string decode the string and do the actions. char firstChar = inString.charAt(0); //start parsing string if (firstChar == 'G'){ //Is it a G-code GCodeParse(); } else if (firstChar == 'M'){//Is it an M-code MCodeParse(); } else{//If it is nether a G or M code send to the computer to continue. Serial.println("continue"); } //stop parsing and erase string inString = 0; } else{ inString.append(inChar); // if you're not at the end of the string, append the incoming character }
} }
void MCodeParse(){ if (inString.equals("M101")){ Serial.println("Extruder on"); //add code for turning on extruder ---------------------------------------------------<<< Serial.println("continue"); // Tell the computer to go on. } else if (inString.equals("M103")){ Serial.println("Extruder off"); //add code for extruder off ---------------------------------------------------<<< Serial.println("continue"); // Tell the computer to go on. } else if (inString.equals("M106")){ Serial.println("Fan on"); //add code for fan on ---------------------------------------------------<<< Serial.println("continue"); // Tell the computer to go on. } else if (inString.equals("M107")){ Serial.println("Fan off"); //add code for fan of ---------------------------------------------------<<< Serial.println("continue"); // Tell the computer to go on. } // ----------- do we need extruder P,I,and D gain? Do we need set temp or extrude speed ------------- else{ Serial.println("continue"); // If unknow code tell the computer to go on. } }
void GCodeParse(){ if (inString.startsWith("G0 ") || inString.startsWith("G1 ")){ // Is the code for positioing? //Code for finding X Y and Z cordenents int xcharloc = inString.indexOf('X'); //find where the X code starts int ycharloc = inString.indexOf('Y'); //find where the Y code starts int zcharloc = inString.indexOf('Z'); //find where the Z code starts xcharloc = xcharloc + 1;// Code for finding what X is in the code ycharloc = ycharloc - 1; xstr = inString.substring(xcharloc, ycharloc); ycharloc = ycharloc + 1; ycharloc = ycharloc + 1; // Code for finding what Y is in the code zcharloc = zcharloc - 1; ystr = inString.substring(ycharloc, zcharloc); zcharloc = zcharloc + 1;
int zlast = inString.length(); // Code for finding what z is in the code, This is some more complex code if(inString.contains("F")){ int fcharloc = inString.indexOf('F'); //find where the F code starts zcharloc = zcharloc + 1; fcharloc = fcharloc - 1; zstr = inString.substring(zcharloc, fcharloc); zcharloc = zcharloc - 1; fcharloc = fcharloc + 1; }else{ zcharloc = zcharloc + 1; zstr = inString.substring(zcharloc, zlast); Serial.print(zstr); Serial.println(" <Z value"); zcharloc = zcharloc - 1; } xDouble = atof(xstr); //convert string with x cordanents to double format yDouble = atof(ystr); //convert string with y cordanents to double format zDouble = atof(zstr); //convert string with z cordanents to double format Serial.print("X as a double : "); Serial.println(xDouble); Serial.print("Y as a double : "); Serial.println(yDouble); Serial.print("Z as a double : "); Serial.println(zDouble); if(zCurrent == zDouble){ // If a new Z position is not requested do nothing. }else{//if it is requested move the axie while(zCurrent < zDouble){ //Do we move up? //Move tward zDouble by 0.01 units Serial.print("z+"); zCurrent = zCurrent + 0.01; //write in current location } while(zCurrent > zDouble){ //Or do we move down? //Move tward zDouble by 0.01 units Serial.print("z-"); zCurrent = zCurrent - 0.01; //write in current location } } move(); Serial.println("continue"); // Tell the computer to go on when you are done. }
else if (inString.startsWith("G20 ")){ units = "in"; Serial.println("continue"); // Tell the computer to go on. } else if (inString.startsWith("G21 ")){ units = "mm"; Serial.println("continue"); // Tell the computer to go on. } // ---------------------------???Do we need "G28, G30, G90, G91, G92"??? Arcs? Dwells?-------------------------- else{ Serial.println("continue"); // If unknow code tell the computer to go on. }
}
void xBig(){ } void yBig(){ } void xSmall(){ if(xDouble == xCurrent){ //do nothing!!! }else{ if(xCurrent < xDouble){ //Do we move up? Serial.print("x+"); //Move tward zDouble by 0.01 units xCurrent = xCurrent + 0.01; //write in current location }else{ Serial.print("x-"); //Move tward zDouble by 0.01 units xCurrent = xCurrent - 0.01; //write in current location } } } void ySmall(){ if(yDouble == yCurrent){ //do nothing!!! }else{ if(yCurrent < yDouble){ //Do we move up? Serial.print("y+"); //Move tward zDouble by 0.01 units yCurrent = yCurrent + 0.01; //write in current location }else{ Serial.print("y-"); //Move tward zDouble by 0.01 units yCurrent = yCurrent - 0.01; //write in current location } } }
void move(){ while(xDouble != xCurrent||yDouble != yCurrent);{ // Find the difference if(yDiference > 0 && xDiference > 0){ if(xDouble > xCurrent){ xDiference = xDouble - xCurrent; }else{ xDiference = xCurrent - xDouble; } if(yDouble > yCurrent){ yDiference = yDouble - yCurrent; }else{ yDiference = yCurrent - yDouble; } if(xDiference > yDiference){ Diference = xDiference/yDiference; }else{ Diference = yDiference/xDiference; } // STOP finding the difference }else{ }
Serial.print(Diference); // Tell the godfather what the difference is. Serial.print("X: "); Serial.print(xCurrent); Serial.print("Y: "); Serial.println(yCurrent);
if(xDiference > yDiference){ xSmall(); ySmall(); }else{ xSmall(); ySmall(); } }
}
The Part I am having trouble with is the void xSmall(), ySmall(), and move().
|
|
|
|
|