Show Posts
Pages: [1]
1  Using Arduino / Networking, Protocols, and Devices / Arduino ethernet to digital pins on: January 19, 2013, 07:28:47 am
Well there is a possibility that I'm just blind, however I have not been able to find an answer to this issue. Is it possible to access the serial pins or any other digital pins through the ethernet shield as a virtual serialport? I'm helping someone setup a remote control paintball turret. It currently is controlled from a vb.net application with a joystick, through the serial port. Serial port -> Xbee -> Xbee -> Arduino. There is video feedback via WIFI from a web cam. If possible, I'd like to eliminate the xbee and just go through wifi. Computer -> Wifi Router-> Arduino Ethernet shield. It would be very easy to just access it as a virtual serial port, that way I wouldn't have to worry about rewriting the vb.net code.

Any thoughts?

Thanx
2  Using Arduino / Programming Questions / Need some help with double to const char on: August 09, 2012, 08:42:09 am
I'm playing with the video experimenter shield and I'm trying to display values from A0 pin. (Voltage divider to read voltage of a battery)
I can't seem to make it work.
Can you tell me what I'm doing wrong?
The error message I get is  cannot convert 'double' to 'const char*' for argument '2' to 'int sprintf(char*, const char*, ...)'
The error is of course thrown at the sprintf(s, outputValue / 15.270 , millis());

Code:
#include <TVout.h>
#include <fontALL.h>

#define W 136
#define H 96

TVout tv;
unsigned char x,y;
unsigned char originx = 5;
unsigned char originy = 80;
unsigned char plotx = originx;
unsigned char ploty = 40;
char s[32];
unsigned int n = 0;
int index = 0;
int messageLen = 32;
/////////////////////vdc in
const int analogInPin = A0;
int sensorValue = 0;

//int sensorValue = 0;        // value read from the pot
int outputValue = 0;

void setup()  {
  tv.begin(NTSC, W, H);
  initOverlay();
  tv.select_font(font4x6);
  tv.fill(0);
//  drawGraph();
  randomSeed(analogRead(0));
}

// Initialize ATMega registers for video overlay capability.
// Must be called after tv.begin().
void initOverlay() {
  TCCR1A = 0;
  // Enable timer1.  ICES0 is set to 0 for falling edge detection on input capture pin.
  TCCR1B = _BV(CS10);

  // Enable input capture interrupt
  TIMSK1 |= _BV(ICIE1);

  // Enable external interrupt INT0 on pin 2 with falling edge.
  EIMSK = _BV(INT0);
  EICRA = _BV(ISC11);
}

// Required to reset the scan line when the vertical sync occurs
ISR(INT0_vect) {
  display.scanLine = 0;
}


void loop() {

sensorValue = analogRead(analogInPin);  
outputValue = map(sensorValue, 0, 1023, 0, 255);
  sprintf(s, outputValue / 15.270 , millis());
  tv.print(0, 0, s);
sprintf(s, "this works", millis());
tv.print(0, 80, s);
}


Thanks

Moderator edit: tags corrected.
3  Using Arduino / Programming Questions / Re: Sparkfun Max7456 breakout board on: December 01, 2011, 08:49:54 pm
 smiley-razz
http://www.sparkfun.com/products/9168
4  Using Arduino / Programming Questions / Sparkfun Max7456 breakout board on: December 01, 2011, 07:40:52 pm
Does anyone have a working sample for that? I'm trying to display just 4 characters in the top left corner with no luck.......

Thanx
5  Using Arduino / Programming Questions / Am I doing this right? on: June 28, 2011, 03:06:39 pm
I have a scenario where I have 2 arudino uno boards, both with XPORTs atatched to them for Serial over IP communication. I have a push-button on one side which is turning an LED on/off on the opposite side. If the button is pressed, the LED turns ON. If released, the LED goes off.

Here's the code for the push button side.

Code:
const int buttonPin = 12;     // the number of the pushbutton pin
const int ledPin =  13;      // the number of the LED pin

// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);     
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);
Serial.begin(9600); 
}

void loop(){
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {     
    // turn LED on:   
    digitalWrite(ledPin, HIGH); 
    Serial.println("on");
    delay(1000);
  }
  else {
    // turn LED off:
    digitalWrite(ledPin, LOW);
    Serial.println("off");
    delay(1000);
   
  }
}



Here's the code for the opposite side:

Code:
#define LED 13

int input = 0;       // variable to keep the data from the serial port

void setup() {
  pinMode(LED,OUTPUT);    // declare the LED's pin as output
  Serial.begin(9600);        // connect to the serial port
}

void loop () {
  input = Serial.read();      // read the serial port

  // if the input is 'on' turn the LED ON, if 'off' turn it OFF
  if (input == 'on' ) {
    digitalWrite(LED,HIGH);
    Serial.println("LED13 is ON");
  }
  if (input == 'off'){
      digitalWrite(LED, LOW);
      Serial.println("LED13 is OFF");
  }
}

I think it'll work this way but I'm wondering if there is a better more efficient way of doing it rather than just delay it. What would be more ideal is simply sending a string whenever the button is pressed, then if the LED is on, then turn it off, if it is on, turn it on.

Any ideas?

Thanx
6  Using Arduino / Programming Questions / Re: Simple timed serial event on: May 20, 2011, 05:28:36 am
thanx I'll try this.
I know exactly what the string is as it would be sent from the transmitter and it would be just the text "failsafe" coming every 500ms. If it doesn't come, just stop. (Center servos)
7  Using Arduino / Programming Questions / Simple timed serial event on: May 19, 2011, 07:20:13 pm
Hi all smiley

I'm trying to come up with a snipet that looks for an incoming string on the serial port. If the code does not show up every second, the do something. It would be a failsafe for a serial port controlled R/C car. The controller would send out "something" every second to verify that there is radio connection.(Xbee)  Arduino on the other side would look for this signal and if it didn't show for a sec, center the servo (throttle).

thanx
8  Community / Gigs and Collaborations / Looking for developer with strong serial port and PWM experince on: May 16, 2011, 06:14:15 pm
For a fairly complex project that involves receiving R/C signals and sending them through serial a serial port, then turning it back into PPM.

Pm me your contact info.
9  Using Arduino / Programming Questions / Re: Reading Futaba PPM on: May 12, 2011, 09:19:10 am
Here's a video link to what I mean
10  Using Arduino / Programming Questions / Reading Futaba PPM on: May 12, 2011, 08:35:59 am
Hi All,

Rookie here.
I'm trying to read PPM signals from a Hitec or Futaba TX via the PPM pin, then display it through the serial port, channel by channel, then visually display it in a .net application. It works like a charm, but my issue is that the numbers coming off either TX (Hitex/Futaba) the numbers are always "twitching", not consistent.
Code:
#define channumber 9
int value[channumber];

void setup()
{
Serial.begin(115200);
pinMode(2, INPUT);
}
void loop()
{
while(pulseIn(2, LOW) < 5000){}
for(int x=0; x<=channumber-1; x++)
{
value[x]=pulseIn(2, LOW);
}
for(int x=0; x<=channumber-1; x++)
{
 Serial.print("|");
Serial.print(value[x]);

value[x]=0;
}
Serial.println(" ");
}


Is there a way to somehow filter it so the numbers remain more consistent? It is a bit of an issue because I'm trying to send the numbers through an RF module to another arduino which in turn translates the numbers into servo commands, but because of this, the servos are always moving, or humming a bit.

Thanx
Pages: [1]