Show Posts
Pages: 1 ... 323 324 [325] 326 327 ... 657
4861  Using Arduino / Project Guidance / Re: Interfacing an Altimeter that has Serial Output on: November 30, 2012, 01:37:09 pm
The "buffering input" code below on Nick's page below would seem to do what you are looking for (assuming the altimeter values are sent as characters). You could add the atoi function if needed.

http://www.gammon.com.au/forum/?id=11425
4862  Using Arduino / Programming Questions / Re: Writing CSS style data to a page via ethernet shield on: November 28, 2012, 09:37:21 pm
Quote
Is it possible to add a command to force the browser to reload the page after i click a link?

The page should be reloading each time you click the light button.
4863  Using Arduino / Project Guidance / Re: Live tracking weight changes on: November 28, 2012, 06:27:07 pm
You might could use force sencing resistors like below.


https://www.google.com/search?num=100&hl=en&lr=&tbo=d&as_qdr=all&q=fsr+force+sensing+resistor&oq=fsr+resistor&gs_l=serp.1.1.0j0i7j0i7i30j0i7i10i30j0i7i30l3.11644.13365.0.19594.2.2.0.0.0.0.125.207.1j1.2.0.les%3B..0.0...1c.1.nYQNn85f7Gs
4864  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet shield DHCP on Cisco Linksys E1200 on: November 27, 2012, 11:11:35 pm
Have you checked the setup in the router?
4865  Topics / Home Automation and Networked Objects / Re: HELP on pushingbox HTTP request on: November 27, 2012, 09:05:31 pm
Is devid and vxxxxx the same?
4866  Using Arduino / General Electronics / Re: Arduino to Arduino for ROV on: November 27, 2012, 08:33:39 pm
Something like the below could be used on the receiving arduino to control servos.

Code:
//zoomkat 11-22-12 simple delimited ',' string parce
//from serial port input (via serial monitor)
//and print result out serial port
//multi servos added

String readString;
#include <Servo.h>
Servo myservoa, myservob, myservoc, myservod;  // create servo object to control a servo

void setup() {
  Serial.begin(9600);

  //myservoa.writeMicroseconds(1500); //set initial servo position if desired

  myservoa.attach(6);  //the pin for the servoa control
  myservob.attach(7);  //the pin for the servob control
  myservoc.attach(8);  //the pin for the servoc control
  myservod.attach(9);  //the pin for the servod control
  Serial.println("multi-servo-delimit-test-dual-input-11-22-12"); // so I can keep track of what is loaded
}

void loop() {

  //expect single strings like 700a, or 1500c, or 2000d,
  //or like 30c, or 90a, or 180d,
  //or 30c,180b,70a,120d,

  if (Serial.available())  {
    char c = Serial.read();  //gets one byte from serial buffer
    if (c == ',') {
      if (readString.length() >1) {
        Serial.println(readString); //prints string to serial port out

        int n = readString.toInt();  //convert readString into a number

        // auto select appropriate value, copied from someone elses code.
        if(n >= 500)
        {
          Serial.print("writing Microseconds: ");
          Serial.println(n);
          if(readString.indexOf('a') >0) myservoa.writeMicroseconds(n);
          if(readString.indexOf('b') >0) myservob.writeMicroseconds(n);
          if(readString.indexOf('c') >0) myservoc.writeMicroseconds(n);
          if(readString.indexOf('d') >0) myservod.writeMicroseconds(n);
        }
        else
        {   
          Serial.print("writing Angle: ");
          Serial.println(n);
          if(readString.indexOf('a') >0) myservoa.write(n);
          if(readString.indexOf('b') >0) myservob.write(n);
          if(readString.indexOf('c') >0) myservoc.write(n);
          if(readString.indexOf('d') >0) myservod.write(n);
        }
         readString=""; //clears variable for new input
      }
    } 
    else {     
      readString += c; //makes the string readString
    }
  }
}

4867  Using Arduino / Programming Questions / Re: please help me on: November 27, 2012, 08:16:18 pm
You should be able to test your gizmo using a +5v power source (arduino would do), multimeter set to read voltage, some connective wiring, and a match/lighter.
4868  Using Arduino / Programming Questions / Re: Chat Server - No response back from Serial saying "We have a new client" on: November 27, 2012, 07:40:15 pm
Quote
Then I clicked "Allow a Programs or Feature through Windows Firewall" where I checked "Telnet" and "Telnet Server Remote Administration" for both private and public.  Should I un-check the public box?

For somebody to get at your computer from the internet, you would have to set your router up to foward outside request to your computer's lan IP address and port. I forgot that with windows 7 one has to actually enable telnet.
4869  Using Arduino / Programming Questions / Re: Read String from Serial Input, parse it, and write it to the EEPROM. on: November 27, 2012, 07:29:54 pm
Quote
I've changed all my code to use char arrays instead of strings but I'm still struggling to parse and store data inside the EEPROM.

I couldn't get any of the posted stuff to work either. Below is simple code to captrure a string. It uses the String class thing, but it actually works (at least for me).

Code:
//zoomkat 3-5-12 simple delimited ',' string parce
//from serial port input (via serial monitor)
//and print result out serial port
// CR/LF could also be a delimiter

String readString;

void setup() {
  Serial.begin(9600);
  Serial.println("serial delimit test 1.0"); // so I can keep track of what is loaded
}

void loop() {

  //expect a string like wer,qwe rty,123 456,hyre kjhg,
  //or like hello world,who are you?,bye!,
 
  if (Serial.available())  {
    char c = Serial.read();  //gets one byte from serial buffer
    if (c == ',') {
      //do stuff
      Serial.println(readString); //prints string to serial port out
      readString=""; //clears variable for new input     
     } 
    else {     
      readString += c; //makes the string readString
    }
  }
}

4870  Using Arduino / Motors, Mechanics, and Power / Re: PWM control for a 10 amp brushed motor. on: November 27, 2012, 01:04:05 am
You might need an H-bridge like below.

http://www.ebay.com/itm/30A-H-bridge-Coreless-Motor-Driver-Forward-Reversion-Brake-For-Smart-Car-Arduino-/180983568079?pt=LH_DefaultDomain_0&hash=item2a237616cf
4871  Using Arduino / Interfacing w/ Software on the Computer / Re: Communicating with Arduino via Serial on: November 26, 2012, 07:50:19 pm
Simple LED control code.

Code:
// zoomkat 8-6-10 serial I/O string test
// type a 1 or 0 in serial monitor. then send or enter
// for IDE 0019 and later

void setup() {
  Serial.begin(9600);
  pinMode(13, OUTPUT);
  Serial.println("serial blink 0021"); // so I can keep track of what is loaded
  Serial.println("send a 1 to turn LED on");
  Serial.println("send a 0 to turn LED off");
}

void loop()
{
  while (Serial.available() > 0){
    char c = Serial.read();
    if (c == '1') digitalWrite(13, HIGH);
    if (c == '0') digitalWrite(13, LOW);
  }
}

4872  Using Arduino / Programming Questions / Re: Read String from Serial Input, parse it, and write it to the EEPROM. on: November 26, 2012, 07:22:14 pm
Quote
Simple example that will read numbers from the serial line until it gets a new line and convert to an int:

interesting snippet, but I seem to have a compile error at    inByte[0] = '\0';
4873  Using Arduino / Programming Questions / Re: Chat Server - No response back from Serial saying "We have a new client" on: November 26, 2012, 12:17:52 am
The below code is the example chatserver code. Upload it. Open the arduino serial monitor. Then go windows start > all programs > accessorys, and open "command prompt". Type in telnet 192.168.1.177 and hit the enter key. You should get a black screen with a blinking cursor. start typing and see what appears in the serial monitor.

Code:
/*
 Chat  Server
 
 A simple server that distributes any incoming messages to all
 connected clients.  To use telnet to  your device's IP address and type.
 You can see the client's input in the serial monitor as well.
 Using an Arduino Wiznet Ethernet shield.
 
 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13
 * Analog inputs attached to pins A0 through A5 (optional)
 
 created 18 Dec 2009
 by David A. Mellis
 modified 12 March 2012
 by Tom Igoe
 
 */

#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network.
// gateway and subnet are optional:
byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1, 177);
IPAddress gateway(192,168,1, 1);
IPAddress subnet(255, 255, 0, 0);


// telnet defaults to port 23
EthernetServer server(23);
boolean alreadyConnected = false; // whether or not the client was connected previously

void setup() {
  // initialize the ethernet device
  Ethernet.begin(mac, ip, gateway, subnet);
  // start listening for clients
  server.begin();
  // open the serial port
  Serial.begin(9600);
  Serial.print("Chat server address:");
  Serial.println(Ethernet.localIP());
}

void loop() {
  // wait for a new client:
  EthernetClient client = server.available();

  // when the client sends the first byte, say hello:
  if (client) {
    if (!alreadyConnected) {
      // clead out the input buffer:
      client.flush();   
      Serial.println("We have a new client");
      client.println("Hello, client!");
      alreadyConnected = true;
    }

    if (client.available() > 0) {
      // read the bytes incoming from the client:
      char thisChar = client.read();
      // echo the bytes back to the client:
      server.write(thisChar);
      // echo the bytes to the server as well:
      Serial.write(thisChar);
    }
  }
}

4874  Using Arduino / Project Guidance / Re: need advice - arduino ethernet + 10 sensors + servo output on: November 25, 2012, 06:31:31 pm
Why not try it to see how it works if you already have the hardware?
4875  Using Arduino / Programming Questions / Re: Chat Server - No response back from Serial saying "We have a new client" on: November 25, 2012, 06:20:06 pm
Quote
I'm in the router's administration tool.

Look at the lan IP address of the router (normally 192.168.1.1 or 192.168.0.1). That is what you use for the gateway, and use the first three numbers for the basis of the arduino IP address. Below is some test code that will show the router assigned IP address in the serial monitor.

Code:
//zoomkat 2-13-12
//DNS and DHCP-based web client test code
//for use with IDE 1.0
//open serial monitor and send an e to test
//and to see test result
//for use with W5100 based ethernet shields
//browser equivelant URL:
// http://web.comporium.net/~shb/arduino.txt
//note that the below bug fix may be required
// http://code.google.com/p/arduino/issues/detail?id=605

#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
char serverName[] = "web.comporium.net"; // zoomkat's test web page server
EthernetClient client;

//////////////////////

void setup(){
  Serial.begin(9600);
  Serial.println("DNS and DHCP-based web client test 2/13/12"); // so I can keep track of what is loaded
  Serial.println("Send an e in serial monitor to test"); // what to do to test
  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }
  // print your local IP address:
  Serial.print("Arduino IP address: ");
  for (byte thisByte = 0; thisByte < 4; thisByte++) {
    // print the value of each byte of the IP address:
    Serial.print(Ethernet.localIP()[thisByte], DEC);
    Serial.print(".");
  }
  Serial.println();
  Serial.println();
}

void loop(){
  // check for serial input
  if (Serial.available() > 0) //if something in serial buffer
  {
    byte inChar; // sets inChar as a byte
    inChar = Serial.read(); //gets byte from buffer
    if(inChar == 'e') // checks to see byte is an e
    {
      sendGET(); // call sendGET function below when byte is an e
    }
  }  
}

//////////////////////////

void sendGET() //client function to send/receive GET request data.
{
  if (client.connect(serverName, 80)) {  //starts client connection, checks for connection
    Serial.println("connected");
    client.println("GET /~shb/arduino.txt HTTP/1.0"); //download text
    client.println(); //end of get request
  }
  else {
    Serial.println("connection failed"); //error message if no client connect
    Serial.println();
  }

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c = client.read(); //gets byte from ethernet buffer
    Serial.print(c); //prints byte to serial monitor
  }

  Serial.println();
  Serial.println("disconnecting.");
  Serial.println("==================");
  Serial.println();
  client.stop(); //stop client

}


Pages: 1 ... 323 324 [325] 326 327 ... 657