Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: Feedback data usage help on: July 29, 2013, 02:10:43 pm
bump
2  Using Arduino / Programming Questions / Re: Feedback data usage help on: July 27, 2013, 09:11:28 pm
I'm having some issues.  I have that code working well.  However when i use my code to set it to a integer it will work for one run and then the integer resets to 0.  I thought that integers stayed set until you changed them.  

Could you help me figure out why the integer is resetting to 0?  intigers clipsGet and currentClip both are set to the number of clips in the function clipsGet however they do not hold their values after being set.

Code:
#include <SPI.h>
#include <Ethernet.h>
#include <Bounce.h>
#include <TextFinder.h>
 
#define BUTTON1 14
#define BUTTON2 15
#define BUTTON3 16
#define rLED 17
#define gLED 18

Bounce bouncer1 = Bounce( BUTTON1,5 );
Bounce bouncer2 = Bounce( BUTTON2,5 );
Bounce bouncer3 = Bounce( BUTTON3,5 );


byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x11 };
byte ip[] = { 192, 168, 1, 30 };
byte gateway[] = { 192, 168, 1, 1 };
byte subnet[] = { 255, 255, 255, 0 };
IPAddress server(192,168,1,21);
EthernetClient client;
TextFinder  finder( client );

int rledValue = LOW;
int gledValue = LOW;
int playSpeed = 100;
String sensorValueString = "speed:";

int clipsGet = 0;
int currentClip = 0;

void setup() {
  Serial.begin(9600);
  pinMode(BUTTON1,INPUT);
  pinMode(BUTTON2,INPUT);
  pinMode(BUTTON3,INPUT);
  pinMode(rLED,OUTPUT);
  pinMode(gLED,OUTPUT);
 
  Ethernet.begin(mac, ip);
  delay(1000);   // give the Ethernet shield a second to initialize:
  Serial.println("connecting..."); 
 
  if (client.connect(server, 9993)) {    // if you get a connection, report back via serial:
    Serial.println("connected");
    Serial.println(client.read());
  }
  else {  // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
}
 
void loop()  {
 
  bouncer1.update ( );
  bouncer2.update ( );
  bouncer3.update ( );
 
 
  int buttonValue1 = bouncer1.read();
  int buttonValue2 = bouncer2.read();
  int buttonValue3 = bouncer3.read();
 
if (client.connected()) {
 
     if (buttonValue1 == HIGH) {
        client.println("clips get");
         if(finder.find("clip count: ") ) {
         int clipsGet = finder.getValue();
         int currentClip = clipsGet;
         Serial.println(currentClip);
         client.flush();
       } else {
        Serial.print("No Clip Data");     
       }
    delay(150);
     }
     
 
     if (buttonValue2 == HIGH) {
       funBackClip();
       delay(150);
     }     
     
      if (client.available()) {
        char c = client.read();
        Serial.print(c);
       }


} else {
  Serial.println();
  Serial.println("disconnecting.");
  client.stop();
  while(true);
  }
}
3  Using Arduino / Programming Questions / Re: Feedback data usage help on: July 27, 2013, 02:40:06 pm
I already have that up and working.  It was exactly what I needed.

Thanks for the direction zoomkat. I never would have known that existed.
4  Using Arduino / Programming Questions / Re: Feedback data usage help on: July 27, 2013, 02:02:51 pm
Awesome, thanks!

I'll get to work on that.
5  Using Arduino / Programming Questions / Re: Feedback data usage help on: July 27, 2013, 01:58:40 pm
Thanks for your help so far.  I"ve been able to get the input from the ethernet stored in a text file on the SD card.

The input from the ethernet is really filled with a lot of information that I don't need.  I think all I really need is total clips from the second line of input.  Is there a way to get just that piece of information stored as a variable?

I think if I can get the total clips I could then use it to move back and forward through the clips.

Thanks!
6  Using Arduino / Programming Questions / Re: Feedback data usage help on: July 21, 2013, 08:53:08 am
Thanks Zoomkat, your response was very informative.  I do need to remember i'm on a programming forum where people seem to think much more logically and directly than some of the other forums so I do need to use technical terms referring to inputs and outputs etc.  I'll try to do better at that next time.

The ethershield I have does have the micro sd onboard and I happened to save the 16gb card from my old Droid phone which will work perfectly.  I"ll get to work on testing with that sample code and see where I can get.

If only someone telling me it's easy magically made me know how to do it. lol
7  Using Arduino / Programming Questions / Re: Feedback data usage help on: July 20, 2013, 09:09:45 am
Thanks Paul.

I came to this forum looking for help on a project that is admittedly above my programming level.  However without challenging myself I will never be able to learn. I came here thinking that someone may be able to help me along though this part of it.. 

I apologize for wasting your bandwidth.
8  Using Arduino / Programming Questions / Re: Feedback data usage help on: July 20, 2013, 08:27:25 am
Thanks for that PaulS.  I got that delay taken out, not sure why it was there.

The shield has a SD card that is available for storage.  Would I be able to use that to store that data?

Any idea if there is any sample code for what I'm trying to do that I could go off of?
Thanks!
9  Using Arduino / Programming Questions / Re: Feedback data usage help on: July 20, 2013, 07:55:21 am
Thanks for the reply,

It's connected over TCP/IP via an Ethernet Shield.  Basically it's a simply telnet connection.  After it establishes a connection I am able to output text commands from the arduino such as "play" or "clips get" etc.  The switcher does that appropriate action and then replies over TCP with either an OK code or and OK code and the info I requested (like the list of clips on the unit).

The larger picture is that I have a control surface with a number of buttons that will connect to a USB host shield.  I am working on programming the buttons to then send their commands when pressed.  The code I have is attached.   None of the code that is in what I have is related to the actual clips get because i have no idea how to even start using the info it returns after that command.

Code:

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

#define BUTTON1 2   // Define pins
#define BUTTON2 3   // Define pins
#define BUTTON3 5   // Define pins
#define BUTTON3 6   // Define pins
#define LED 14          // Define pins


Bounce bouncer1 = Bounce( BUTTON1,5 );  // Define debounce
Bounce bouncer2 = Bounce( BUTTON2,5 );  // Define debounce
Bounce bouncer3 = Bounce( BUTTON3,5 );  // Define debounce
Bounce bouncer4 = Bounce( BUTTON4,5 );  // Define debounce

int ledValue = LOW;  //Led starts off
int playSpeed = 100;  // playSpeed starts at 100
String sensorValueString = "speed:";

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
// if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server:
IPAddress server(192,168,1,133);  // numeric IP for Google (no DNS)
// server[] = "www.google.com";    // name address for Google (using DNS)

// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(192,168,1,177);

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

// Initialize sensors

void setup() {
 // Open serial communications and wait for port to open:
  Serial.begin(9600);   /Begin Serial Communication
  pinMode(BUTTON1,INPUT);  //define input or output
  pinMode(BUTTON2,INPUT);  //define input or output
  pinMode(BUTTON3,INPUT);  //define input or output
  pinMode(BUTTON4,INPUT);  //define input or output
  pinMode(LED,OUTPUT);  //define input or output

  // 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:
    // try to congifure using IP address instead of DHCP:
    Ethernet.begin(mac, ip);
  }
  // give the Ethernet shield a second to initialize:
  delay(1000);
  Serial.println("connecting...");

  // if you get a connection, report back via serial:
  if (client.connect(server, 9993)) {
    Serial.println("connected");
    Serial.println(client.read());
  }
  else {
    // kf you didn't get a connection to the server:
    Serial.println("connection failed");
  }
}

void loop()
{
  bouncer1.update ( );  // Update bounce state with library
  bouncer2.update ( );  // Update bounce state with library
  bouncer3.update ( );  // Update bounce state with library
  bouncer4.update ( );  // Update bounce state with library
  
  
  int buttonValue1 = bouncer1.read();  // Read button state
  int buttonValue2 = bouncer2.read();  // Read button state
  int buttonValue3 = bouncer3.read();  // Read button state
  int buttonValue4 = bouncer4.read();  // Read button state
  
    if (buttonValue3 == HIGH) {  // if button 3 is pressed
    client.println("record");       // start recording
    delay(150);                         // wait so you don't get multiple presses
  }
  
    if (buttonValue2 == HIGH) {  // if button 2 is pressed
    client.println("stop");          // stop
    delay(150);                         // wait so you don't get multiple presses
  }
  
   if (buttonValue1 == HIGH) { // if button 1 is pressed
    client.println("play");          // play
    delay(150);                         // wait so you don't get multiple presses
  }
  
    if (buttonValue4 == HIGH) { // if button 4 is pressed
    client.println("clips get");    // get clip info
    delay(150);                         // wait so you don't get multiple presses
  }
  
  
   if (client.available()) {     // if a reply is available from the HyperDeck
    char c = client.read();    // read it and print it so serial.
    Serial.print(c);
    delay(5);
  }
  
  if (!client.connected()) {  // if client isn't connected stop the client.
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();

    // do nothing forevermore:
    while(true);
  }
     }

Thanks!
10  Using Arduino / Programming Questions / Feedback data usage help on: July 19, 2013, 09:57:41 pm
Hey All,

I'm working on writing a program that controls a video replay machine.  The control is over IP and is very basic text with simple response.  There is no go back a clip or go forward a clip command.  What I can do however is say "clips get" and it will respond with all of the clips, their name, and their clip count number (i.e. clip 1, clip 2 etc).

What i am needing is help making a code that will store the feedback of the clips command and then let me go back and forward through the clips.  There is no "current clip" so that will have to be stored on the arduino.

Here is the output of the clips get command.

clips get
205 clips info:
clip count: 19
1: Capture0000.mov 00:00:01:25
2: Capture0001.mov 00:00:02:15
3: Capture0002.mov 00:00:04:01
4: Capture0003.mov 00:00:00:23
5: Capture0004.mov 00:00:01:07
6: Capture0005.mov 00:00:20:03
7: Capture0006.mov 00:00:01:08
8: Capture0007.mov 00:00:01:06
9: Capture0008.mov 00:00:05:14
10: Capture0009.mov 00:00:01:06
11: Capture0010.mov 00:00:01:03
12: Capture0011.mov 00:00:02:07
13: Capture0012.mov 00:00:01:00
14: Capture0013.mov 00:00:02:20
15: Capture0014.mov 00:00:06:07
16: Capture0015.mov 00:00:09:13
17: Capture0016.mov 00:00:04:14
18: Capture0017.mov 00:00:03:19
19: Capture0018.mov 00:00:01:23

Is it possible to run that command and store those telling it the current clip is 19.  Then if i hit back it will go to 18 then 17 then 16 etc etc. i'd like there to be a way to push the button twice quickly to go to the first clip, but I can add that later.

Thanks!
11  Using Arduino / Motors, Mechanics, and Power / Re: Issues with dfRobot Motorshield and Arduino on: January 30, 2013, 08:31:04 pm
Some more helpful information.  When i put a tester on the Ping sensor data pin it goes between 15 and 30 mv.   When i turn on the motor shield it jumps to 1.8 - 2.0 volts.   Do you guys think I have a bad motor shield?  Why is the voltage bleeding like this?  Can I put something on the data pin to keep the voltage down?
12  Using Arduino / Motors, Mechanics, and Power / Issues with dfRobot Motorshield and Arduino on: January 28, 2013, 08:12:11 pm
Hey Guys,

I've been having a rough time getting my arduino uno, dfRobot 2A motor shield, ping sensor, and 2 6v motors to work properly.

I have the Uno powered off of 5xAA for 7.5v.
The motor shield is powered of off 4xAA for 6v.
ping sensor powered off of the arduino and plugged into D14/A0.

When turned off the motor shield, the ping sensor works and reads fine.  When i turn the motor shield on the ping sensor goes crazy.  I checked the Voltage on the 5v and it runs at 5.04v with the motor shield on and off.

I went a head and uploaded the basic program for just the motor shield and 2 motors.  I noticed that when i turned it all on the ping sensor's ACT light still it up even though I didn't have it in the program.  After unplugging the SIG line on the PING sensor the act light was still blinking making me thing that the motors are polluting the arduino's 5v with pwm signal.

Has anyone else seen this or have an idea what I can do?

Thanks

Rev1.  It seems that when i plug the ping sensor into the 5v from the Arduino I start to get issues.  It is now starting to make it so the motor wont spin unless the 5v from the sensor is unplugged.  I can however touch the sensor 5v to an external 5v supply and it works great.  So i guess the question is why is the ping sensor causing issues?  The power reads 5v on the arduino pin if the motors are off or on.
Pages: [1]