Show Posts
|
|
Pages: [1] 2 3 ... 11
|
|
2
|
Using Arduino / Sensors / PT1000 Analog input temperature & Arduino 1.0.4
|
on: April 03, 2013, 08:10:58 am
|
Hi there, I have a PT1000 Temperature sensor that changes resistance when temperature is changed. I have found the code below but I cannot call a function called "GetPlatinumRTD();", the debugger says that I need to declare more variables in void setup. I have just connected the PT1000 red-wire to A0 & white-wire to GND. how to call the function please? debugging: sketch_apr03a.ino: In function 'void loop()': sketch_apr03a:4: error: too few arguments to function 'float GetPlatinumRTD(float, float)' sketch_apr03a:4: error: at this point in file
void setup() { }
void loop() { GetPlatinumRTD(); delay(1000); }
float GetPlatinumRTD(float R,float R0) { float A=3.9083E-3; float B=-5.775E-7; float T; R=R/R0; //T = (0.0-A + sqrt((A*A) - 4.0 * B * (1.0 - R))) / 2.0 * B; T=0.0-A; T+=sqrt((A*A) - 4.0 * B * (1.0 - R)); T/=(2.0 * B); if(T>0&&T<200) { return T; } else { //T= (0.0-A - sqrt((A*A) - 4.0 * B * (1.0 - R))) / 2.0 * B; T=0.0-A; T-=sqrt((A*A) - 4.0 * B * (1.0 - R)); T/=(2.0 * B); return T; } } In the topic given below, found the code that seems to be working in older versions of Arduino. http://arduino.cc/forum/index.php/topic,43605.0.html
|
|
|
|
|
4
|
Using Arduino / Networking, Protocols, and Devices / Re: Connect Arduino and phpMyadmin
|
on: March 26, 2013, 05:19:14 pm
|
I replaced it, it connects OK but I can't retrieve on the browser the "temp1=1" value. The php code I use is this one: <? $temp1 = $HTTP_GET_VARS['temp1']; ?> <html> <body> test server page<br> <? echo('temp1 = ' . $temp1 . ' '); ?> </body> </html> And that's what I get on the serial monitor. I hope this helps. Ready connecting...connected GET /arduino.php?temp1=0 HTTP/1.0 Host: server_name
HTTP/1.1 200 OK Date: Tue, 26 Mar 2013 22:16:44 GMT Server: Apache/2.2.14 (Ubuntu) X-Powered-By: PHP/5.3.2-1ubuntu4.19 Vary: Accept-Encoding Connection: close Content-Type: text/html
<html> <body> test server page<br> temp1 = </body> </html> disconnecting. Pass 1 connecting...connected GET /arduino.php?temp1=1 HTTP/1.0 Host: servername
HTTP/1.1 200 OK Date: Tue, 26 Mar 2013 22:16:49 GMT Server: Apache/2.2.14 (Ubuntu) X-Powered-By: PHP/5.3.2-1ubuntu4.19 Vary: Accept-Encoding Connection: close Content-Type: text/html
<html> <body> test server page<br> temp1 = </body> </html> disconnecting. Pass 2
I've also attached a screenshot of the page..
|
|
|
|
|
5
|
Using Arduino / Networking, Protocols, and Devices / Re: Connect Arduino and phpMyadmin
|
on: March 23, 2013, 06:35:12 pm
|
No luck...Now it doesn't even connect to the server. With the previous code what I get to serial monitor is the text given below: Ready connecting...connected HTTP/1.1 400 Bad Request Date: Sat, 23 Mar 2013 23:32:38 GMT Server: Apache/2.2.14 (Ubuntu) Vary: Accept-Encoding Content-Length: 328 Connection: close Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>400 Bad Request</title> </head><body> <h1>Bad Request</h1> <p>Your browser sent a request that this server could not understand.<br /> </p> <hr> <address>Apache/2.2.14 (Ubuntu) Server at http://mydomain.com Port 80</address> </body></html>
disconnecting.
Wherever I write domain.com, be aware that I DON'T include in my code the "/arduino.php" which is essential to access it from my browser. etc. www.domain.com/arduino.php
|
|
|
|
|
6
|
Using Arduino / Networking, Protocols, and Devices / Re: Connect Arduino and phpMyadmin
|
on: March 23, 2013, 06:16:23 pm
|
The problem is that I own an account behind a virtual Linux server of someone else and that the code gives a bad request. I think the problem occurs because of wrong setup of IPAddress server declaration. I need it to be declared as a domain. char server (' www.domain.com'); doesn't work as well... #include <SPI.h> #include <Ethernet.h>
byte mac[] = { 0x00, 0x00, 0x1A, 0x2B, 0x3C, 0x4D }; IPAddress ip(192, 168, 1, XXX); IPAddress gateway(192, 168, 1, 254); IPAddress subnet(255, 255, 255, 0);
IPAddress server(XXX,XXX,XXX,XXX); // Change to your server ip
EthernetClient client; int totalCount = 0; int loopCount = 0;
void setup() { Serial.begin(9600);
pinMode(4,OUTPUT); digitalWrite(4,HIGH);
Ethernet.begin(mac, ip, gateway, gateway, subnet); delay(2000); Serial.println("Ready"); }
char pageAdd[32]; void loop() { if(loopCount < 5) { delay(1000); } else { loopCount = 0; sprintf(pageAdd,"/arduino.php?temp1=%d",totalCount); if(!getPage(server,pageAdd)) Serial.print("Fail "); else Serial.print("Pass "); totalCount++; Serial.println(totalCount,DEC); }
loopCount++; }
byte getPage(IPAddress ipBuf,char *page) { int inChar; char outBuf[128];
Serial.print("connecting...");
if(client.connect(ipBuf,80)) { Serial.println("connected");
sprintf(outBuf,"GET %s HTTP/1.0\r\nHost: http://www.domain.com\r\n\r\n",page); // Should it be http://www.domain.com/arduino.php\r\n\r\n" ??? client.write(outBuf); } else { Serial.println("failed"); return 0; }
int connectLoop = 0; while(client.connected()) { while(client.available()) { inChar = client.read(); Serial.write(inChar); connectLoop = 0; }
delay(10); connectLoop++; if(connectLoop > 1000) { Serial.println(); Serial.println("Timeout"); client.stop(); } }
Serial.println();
Serial.println("disconnecting."); client.stop();
return 1; }
|
|
|
|
|
9
|
Topics / Product Design / Eagle 6 - Paste different projects in one board file
|
on: March 07, 2013, 03:18:06 pm
|
|
Hi there!
I've been using eagle 6.3 for some time and I am really frustrated about copy/pasting different projects to one board file so I can send them for manufacture. I need to panelize different projects into one.
I used to do that by cut/pasting in Eagle 5 but now the cut command is missing. Is there any solution to that? It's a shame that Eagle Team doesn't support this action.
I've also found some downloadable ULPs from the offcial Eagle site but I dont know if there is any that does what I need.
If anyone of you, have found a workaround to this issue, please share it with us.
|
|
|
|
|
12
|
Using Arduino / Programming Questions / How to convert Time data from a function to integer.
|
on: February 16, 2013, 06:53:32 pm
|
|
Hi there, I am using Time.h library to get the time from an NTP server and then convert it to integer for further manipulation. But the problem is that I don't know how to make Serial.print(day()); to an integer. Whatever conversion I try I dont get the desired integer.
I give you the Time.h library so you can examine it if you want and help me through...
Please someone help!
|
|
|
|
|
14
|
Using Arduino / Programming Questions / Re: Sketch uploads on Arduino Ethernet R3 but NOT on Arduino MEGA 2560!
|
on: February 16, 2013, 10:34:39 am
|
Good thing. I tried compiling your code, and without the client.remoteIP() function added to the ethernet library, it wouldn't compile for me. It threw a bunch of errors.
That client.remoteIP() function sounds like my addition to the ethernet library. I use it for a primitive firewall as it appears to do in your code also.
I have examined your library changes in files and done something like you did. I do this fo security but its not secure when someone is trying to access your page from the same LAN network.If you have successfully logged in and someone from the same LAN tries to access the page the Arduino will see the other request having the same IP (because I use my DYNDNS domain - Netowork's Public Internet IP address) and let him see the page as logged in. Another thing I need to ask you is why my SD is not recognised in MEGA and is working correctly in Arduino Ethernet. I cant even read or write to the SD card. But on Arduino Ethernet the same code workgs great. Why is that? I have examined pinouts on Arduino Ethernet & MEGA 2560 and seem to use tha same pins. /* SD card read/write This example shows how to read and write data to and from an SD card file The circuit: * SD card attached to SPI bus as follows: ** MOSI - pin 11 ** MISO - pin 12 ** CLK - pin 13 ** CS - pin 4 created Nov 2010 by David A. Mellis modified 9 Apr 2012 by Tom Igoe This example code is in the public domain. */ #include <SD.h>
File myFile;
void setup() { // Open serial communications and wait for port to open: Serial.begin(9600);
Serial.print("Initializing SD card..."); // On the Ethernet Shield, CS is pin 4. It's set as an output by default. // Note that even if it's not used as the CS pin, the hardware SS pin // (10 on most Arduino boards, 53 on the Mega) must be left as an output // or the SD library functions will not work. pinMode(10, OUTPUT); if (!SD.begin(4)) { Serial.println("initialization failed!"); return; } Serial.println("initialization done."); // open the file. note that only one file can be open at a time, // so you have to close this one before opening another. myFile = SD.open("test.txt", FILE_WRITE); // if the file opened okay, write to it: if (myFile) { Serial.print("Writing to test.txt..."); myFile.println("testing 1, 2, 3."); // close the file: myFile.close(); Serial.println("done."); } else { // if the file didn't open, print an error: Serial.println("error opening test.txt"); } // re-open the file for reading: myFile = SD.open("test.txt"); if (myFile) { Serial.println("test.txt:"); // read from the file until there's nothing else in it: while (myFile.available()) { Serial.write(myFile.read()); } // close the file: myFile.close(); } else { // if the file didn't open, print an error: Serial.println("error opening test.txt"); } }
void loop() { // nothing happens after setup }
|
|
|
|
|