Show Posts
|
|
Pages: [1] 2
|
|
2
|
Using Arduino / Project Guidance / Re: Is it possible for an iPhone to read serial data from an Arduino?
|
on: February 17, 2013, 05:56:51 pm
|
Yes an iPhone can receive serial data but you have to register as a developer to write any code on an iPhone. Then the only way you can get this code onto the iPhone is to submit it to Apple and have them put it in the Apps store.
Actually you don't even have to submit it to the app store, you can deploy the app straight to your iPhone/iPod if you're registered as a developer. You can write code for the device without being registered as a developer too, you just need to register to get it on the device. But you're sure an iPhone can receive serial data and code can be written to handle it?
|
|
|
|
|
3
|
Using Arduino / Project Guidance / Is it possible for an iPhone to read serial data from an Arduino?
|
on: February 17, 2013, 05:30:21 pm
|
If I had a TTL serial converter cable such as the Redpark ( http://www.makershed.com/Redpark_TTL_Cable_for_iOS_p/msrp03.htm), is it possible to send serial data to the iPhone from the Arduino and then have the iPhone respond? I've seen people use the cable to transmit data from the iPhone to the Arduino, but not yet the other way around. My purpose for this is to make a breathalyzer apparatus that you simply connect to you phone through something like the Redpark cable, load the app, and blow into the breathalyzer to get feedback on your phone regarding your BAC. If it's impossible for the iPhone to receive data like that over serial due to a software restriction or something, does anybody have any other suggestions? I'm trying to avoid internet connectivity for the sake of ease and simplicity to use.
|
|
|
|
|
5
|
Using Arduino / Networking, Protocols, and Devices / Re: Unable to connect to web server, can't seem to find the problem
|
on: February 12, 2013, 11:11:13 pm
|
Is this ip in the subnet of your localnet? byte ip[] = { 10, 0, 1, 8 };
Are you using the port with it in your web browser? http://10.0.1.8:8010edit: Eye Korretd mi spelin misteak.  Yes and yes These two statements: pinMode(A3, INPUT); and int val = analogRead(A3); //read pot analog input do not go together. Analog pins are input only. They can not be set to output, nor do they have pullup resistors. So, the pinMode() command is completely unaware that they exist. You are diddling with the digital nature of that pin, which you don''t use. So, don't diddle with it. Right, that was my bad. But how would this have an effect on my problem?
|
|
|
|
|
6
|
Using Arduino / Networking, Protocols, and Devices / [Solved] Unable to connect to web server, can't seem to find the problem
|
on: February 11, 2013, 09:42:33 pm
|
I want to adjust the background color of a web page by adjusting a pot, but I can't for the life of me figure out why I'm not able to connect to the web server. I just get "Unable to connect to server" in my browser. Here's the code, help point me towards anything missing or that needs revision please. #include <SPI.h> #include <Ethernet.h>
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x50, 0x9A }; byte ip[] = { 10, 0, 1, 8 };
EthernetServer server(8010);
void setup() {
pinMode(A3, INPUT); Serial.begin(9600); Ethernet.begin(mac, ip); server.begin();
}
void loop() { EthernetClient client = server.available(); int val = analogRead(A3); //read pot analog input if (client) { boolean current_line_is_blank = true; while (client.connected()) { if (client.available()) { char c = client.read(); int color = map(val, 0, 1023, 0x000000, 0xFFFFFF); //map the analogRead() values to HEX values for HTML colors Serial.println(val); //print em' Serial.println(color); Serial.println(); if (c == '\n' && current_line_is_blank) { client.println("HTTP/1.1 200 OK"); //standard HTTP header, a little HTML too client.println("Content-Type: text/html"); client.println(); client.println("<html><head><title>"); client.println("Change pot to change color!"); client.println("</title><body bgcolor="); client.print(color); client.println(">"); client.println("<h1>Hello, World</h1>"); client.println(); client.print("</body></html>"); } if (c == '\n') { current_line_is_blank = true; } else if (c != '\r') { current_line_is_blank = false; } } } delay(1); client.stop(); }
}
|
|
|
|
|
7
|
Using Arduino / Networking, Protocols, and Devices / Controlling LED With Web Server Buttons
|
on: February 02, 2013, 01:18:30 pm
|
Having trouble getting this to function correctly. I have an Arduino with an Ethernet Shield hosting a web server that has two buttons controlling the high or low state of an LED. The page loads fine with the "On" button and the "Off" button using POST, but whenever I press either they don't work. Here's my code, anyone happen see the problem? #include <SPI.h> #include <Ethernet.h>
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x50, 0x9A }; byte ip[] = { 10,0,1,8 };
const int MAX_PAGENAME_LEN = 8; //Max number of characters for page name char buffer[MAX_PAGENAME_LEN+1]; //Max number of characters + terminating null is the buffer
EthernetServer server(8010);
void setup() {
Serial.begin(9600); Ethernet.begin(mac, ip); server.begin();
delay(2000); }
void loop() {
EthernetClient client = server.available(); if (client) { int type = 0; while (client.connected()) { if (client.available()) { memset(buffer, 0, sizeof(buffer)); //clear the buffer if (client.find("/")) { if (client.readBytesUntil('/', buffer, sizeof(buffer))) { Serial.println(buffer); if (strcmp(buffer, "POST ") == 0) { //find the start of the posted form client.find("\n\r"); //skip to the body while(client.findUntil("pinD", "\n\r")) { //find string starting with "pin", stop on first blank line int pin = client.parseInt(); //the number after "pinD" is the pin number int val = client.parseInt(); //the number after the pin number is its value (1 or 0) pinMode(pin, OUTPUT); digitalWrite(pin, val); } } sendHeader(client, "Post example"); //send a standard header, set up both buttons with POST client.println("<h2>Press button to control LED</h2>"); client.print("<form action='/' method='POST'><p><input type='hidden' name='pinD8'"); client.println(" value='1'><input type='submit' value='On'/></form>"); client.print("<form action='/' method='POST'><p><input type='hidden' name='pinD8'"); client.println(" value='0'><input type='submit' value='Off'/></form>"); client.println("</body></html>"); client.stop(); } break; } } delay(1); client.stop(); } } }
void sendHeader(EthernetClient client, char *title) { //standard HTTP header
client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println(); client.print("<html><head><title>"); client.print(title); client.println("</title><body>");
}
|
|
|
|
|
8
|
Using Arduino / Networking, Protocols, and Devices / Re: Arduino Ethernet Web Server With Airport Extreme
|
on: January 13, 2013, 10:16:51 pm
|
do I set the private IP as the Arduino's private IP or the Airport's?
Forward to the Arduino's private IP. And then once I map it will other people be able to use my public IP on the port I forwarded to access the web server?
That's the theory. -br I believe my problem is this. Every time I go to forward a port, I forward it to the Arduino's IP. However then the Airport must restart to apply this change. When this happens, the Arduino is given a new IP. The cycle continues forever?
|
|
|
|
|
9
|
Using Arduino / Networking, Protocols, and Devices / Arduino Ethernet Web Server With Airport Extreme
|
on: January 13, 2013, 08:01:00 pm
|
|
I need some help pertaining to setting up a web server for an Arduino with Ethernet Shield from an Apple Airport Extreme so that it will be available to the world. I have the Arduino connected by an RJ45 LAN cable to an ethernet port on the Airport, and my sketches are working, but only locally. I can't seem to figure out the process from this point on. When I map the ports from the Airport, do I set the private IP as the Arduino's private IP or the Airport's? And then once I map it will other people be able to use my public IP on the port I forwarded to access the web server?
|
|
|
|
|
10
|
Using Arduino / Installation & Troubleshooting / Re: Arduino Uno R3 Communication Problem
|
on: January 13, 2013, 01:17:02 pm
|
|
This is exactly what happened to me once. It's nothing wrong with your USB Serial chip. Unfortunately I can not completely recall what I did to fix it, but I'm almost positive it was just pushing the ATMega chip back into proper place. If that isn't the problem (and you are completely sure), check to make sure the USB connecter is firmly connected to the USB port on your computer and the port on your Arduino. Also check if the "ON" light is green when you connect the USB cable.
|
|
|
|
|
12
|
Using Arduino / Installation & Troubleshooting / Re: Arduino Uno R3 Communication Problem
|
on: January 12, 2013, 01:21:19 pm
|
|
Can you specify what you mean when you say the computer doesn't recognize it? Do you try to upload a sketch and it fails? Or you upload a sketch and nothing happens? Plug in your Arduino and upload a sketch and check to see if the green "ON" light is turned on. Something like this happened to me where I would upload a sketch and nothing would happen and I actually felt the USB port on the Arduino start heating up. I noticed the "ON" light wasn't light up, so I knew there was probably a short or something. Turns out the ATMega chip wasn't all the way in its socket. I just pushed it back in and it worked. But if you ever feel the Arduino start to get hot or its plugged in and the "ON" light isn't green, turn it off right away to avoid damaging the Arduino.
|
|
|
|
|
13
|
Using Arduino / Networking, Protocols, and Devices / Arduino Ethernet Web Server Receiving Client Requests But Not Doing Anything
|
on: January 12, 2013, 01:13:50 pm
|
|
I started playing around with my Arduino and an Ethernet Shield, trying to get an LED to turn on or off when specific HTTP requests are made. I forwarded port 80 on my router and sent the links to turn on or off the LED to my friends. The sketch worked on my side, but nobody else's. The sketch even worked for me when I used both my private and public IP addresses in the link. I even saw TX and RX flashing when people clicked the links, but no action in the LED or Serial Monitor. It's possible I port forwarded wrong, but has anyone else had this problem or knew of a way to fix it if in the event I didn't port forward incorrectly?
|
|
|
|
|
14
|
Using Arduino / Networking, Protocols, and Devices / Arduino Ethernet Networking Setup Help
|
on: January 11, 2013, 05:50:23 pm
|
|
This is part Arduino and part not Arduino, but I was wondering if someone else has gone through this or knows a solution. I have an Arduino with Ethernet Shield hooked up by an RJ45 cable to my MacBook Pro that has sharing internet through ethernet enabled. My MacBook is connected to the internet with WI-FI of course, but through an Airport Extreme hooked up to a router. My question is, how should I go about forwarding port 80 for my Arduino? To simplify, Arduino--->MacBook--->Router--->Airport Extreme. I know my Arduino's private IP and my MacBook's private IP, but Airport Utility asks for an IP that begins with 10.0.1.X. Someone clear my confusion.
|
|
|
|
|
15
|
Using Arduino / Programming Questions / Re: Too many "if" statements?
|
on: January 01, 2013, 05:37:39 pm
|
|
There's always very simple ways to reduce memory usage in your code bit by bit (no pun intended) as well. For example for declaring variables that never change like pin modes with variables assigned to numbers, you might want to define those variables as constant variables that never change with "const". Since the variable is never going to change (like a pinmode), there is no reason for the Arduino to keep track of it all the time.
|
|
|
|
|