Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Networking, Protocols, and Devices / Re: Programming using USR-WIFI232-G on: September 19, 2014, 03:07:42 pm
SUCCESS!!! It must have been a timing issue. Never been so happy to see "+ok"

Now if I can could only remember what I was trying to do in the first place!
2  Using Arduino / Networking, Protocols, and Devices / Re: Programming using USR-WIFI232-G on: September 19, 2014, 10:32:44 am
It varies from immediately to a few seconds.

What time is between the a from the module and you're 'a' being sent to the module? Often these things have a more or less strict timing behavior, although the manual says absolutely nothing about it.
3  Using Arduino / Networking, Protocols, and Devices / Re: Programming using USR-WIFI232-G on: September 17, 2014, 09:45:02 am

Pretty close. Instead of the new input displaying on the next line it is on the same row. So the original code, if I sent "+++" twice I would receive the following :

a
a

With the code you sent, if I send "+++" twice I receive

aa


However, the result when I send "a" is the same..... Nothing.

Quote
thanks for the suggestion, I gave this a try but I get the same results.

Almost impossible that you get exactly the same results. Please post the exact results you get!
4  Using Arduino / Networking, Protocols, and Devices / Re: Programming using USR-WIFI232-G on: September 16, 2014, 07:18:32 pm
thanks for the suggestion, I gave this a try but I get the same results.   smiley-cry

Yes, change your program to:

Code:
void setup(){
       Serial.begin(9600);
       Serial1.begin(115200);
}


void loop() {
       if (Serial.available()){
             Serial1.write(Serial.read());
       }
       if (Serial1.available()) {
              Serial.write(Serial1.read());
       }
}

and try again.
5  Using Arduino / Networking, Protocols, and Devices / Re: Programming using USR-WIFI232-G on: September 12, 2014, 02:26:30 pm
Thanks for the info, do you have any suggestions?
6  Using Arduino / Networking, Protocols, and Devices / Programming using USR-WIFI232-G on: September 11, 2014, 10:03:59 pm
Hello all, does anyone have any experience using the WIFI Module. I am attempting to get through the basic configuration. I am having some problems interfacing with the module on the board. I have attached the code I am using. Along with the schematic showing how the WIFI module to attached, and the page from the WIFI module manual.

The manual walks walks through how to interface with the WIFI module. The first step works fine. I send it “+++” and I get back “a”. However when I send it “a” I don’t get back anything. I should get back “+ok” according to the manual. Please take a look at the code and let me know if I am missing something.

Code:
void setup(){
       Serial.begin(9600);
       Serial1.begin(115200);
}


String inputdata;  // data coming in on serial port
String outputdata;  // data coming out of Module

void loop() {
       if (Serial.available()){
              inputdata = Serial.readStringUntil('\n'); //read data from serial
              Serial.print("Input: ");   Serial.println(inputdata);
              Serial1.print(inputdata); // Send dat to WIFI Module
       }
       if (Serial1.available()) {
              // read the incoming byte:
              outputdata = Serial1.readStringUntil('\n');
              // say what you got:
              Serial.print("WIFI: ");
              Serial.println(outputdata);
       }
}

RESULTS

Input: +++
WIFI: a

Input: a
7  Using Arduino / Programming Questions / Re: MEGA pins_arduino.h file question on: May 11, 2014, 02:57:22 am
Strange.... But they match with this....
http://arduino.cc/en/Hacking/PinMapping2560
8  Using Arduino / Programming Questions / Re: MEGA pins_arduino.h file question on: May 10, 2014, 02:37:37 pm
here is a table with the info
9  Using Arduino / Programming Questions / Re: MEGA pins_arduino.h file question on: May 10, 2014, 12:42:55 am
Yes it will! Thanks
10  Using Arduino / Programming Questions / MEGA pins_arduino.h file question on: May 10, 2014, 12:08:31 am
Does anyone know of a modified pins_arduino.h file for the mega2560 that allows you to access the 16 unmapped pins without using direct port?
11  Using Arduino / Programming Questions / Re: Simple Direct Port Manipulation Question on: May 09, 2014, 01:37:46 pm

However, that line of code generates a read-modify-write sequence so it has to be executed with interrupts disabled...

Code:
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
{
  PORTA = (PINA ^ (1 << ledPin));
}


So the fact that in the original code this was done in an ISR is why interrupts did not need to be disabled?
12  Using Arduino / Programming Questions / Re: Simple Direct Port Manipulation Question on: May 09, 2014, 12:08:44 am


Quote
DDRA ? (THAT DOES NOT COMPUTE)
I am using a MEGA board.

Quote
That's because there is only 3uS between ON and OFF. I don't think you can see that fast.
(hint: look at it with an Oscope on 2uS/DIV.
The code blinks the LED at a rate of 2Hz. It is very slow. It is my attempt at direct port manipulation that contains an error.
13  Using Arduino / Programming Questions / Re: Simple Direct Port Manipulation Question on: May 08, 2014, 11:40:39 pm
I tried this with not success.  LED just stays on.
Code:
#define ledPin PA4

void setup(){
DDRA = (1<<ledPin);
 
// initialize timer1
noInterrupts();           // disable all interrupts
TCCR1A = 0;
TCCR1B = 0;
TCNT1  = 0;

OCR1B = 31250;            // compare match register 16MHz/256/2Hz
TCCR1B |= (1 << WGM12);   // CTC mode
TCCR1B |= (1 << CS12);    // 256 prescaler
TIMSK1 |= (1 << OCIE1B);  // enable timer compare interrupt
interrupts();             // enable all interrupts
}

ISR(TIMER1_COMPB_vect){          // timer compare interrupt service routine
PORTA = (((PINA & (1<<ledPin)) ^ 1) << ledPin);//(ledPin, digitalRead(ledPin) ^ 1);   // toggle LED pin
}

void loop(){


}
14  Using Arduino / Programming Questions / Re: Simple Direct Port Manipulation Question on: May 08, 2014, 11:35:01 pm
I understand (somewhat) the bitwise XOR. Or are you saying that there is an error in the line of code below. Will this not toggle the stat of the pin?

 I need to know how to execute this line of code with the digitalread and write functions using direct port manipulation.

Code:
digitalWrite(ledPin, digitalRead(ledPin) ^ 1);   // toggle LED pin
15  Using Arduino / Programming Questions / Re: Simple Direct Port Manipulation Question on: May 08, 2014, 11:18:51 pm
Really??  Someone much smarter than me wrote it.. I got it from here
http://letsmakerobots.com/content/arduino-101-timers-and-interrupts

The example code works just fine just I would like to know how to execute that line of code if using direct port manipulation. Its is an XOR operation which changes the pin state of the LED every time it is called.

Code:
/* Arduino 101: timer and interrupts
   1: Timer1 compare match interrupt example
   more infos: http://www.letmakerobots.com/node/28278
   created by RobotFreak
*/

#define ledPin 13

void setup()
{
  pinMode(ledPin, OUTPUT);
  
  // initialize timer1
  noInterrupts();           // disable all interrupts
  TCCR1A = 0;
  TCCR1B = 0;
  TCNT1  = 0;

  OCR1A = 31250;            // compare match register 16MHz/256/2Hz
  TCCR1B |= (1 << WGM12);   // CTC mode
  TCCR1B |= (1 << CS12);    // 256 prescaler
  TIMSK1 |= (1 << OCIE1A);  // enable timer compare interrupt
  interrupts();             // enable all interrupts
}

ISR(TIMER1_COMPA_vect)          // timer compare interrupt service routine
{
  digitalWrite(ledPin, digitalRead(ledPin) ^ 1);   // toggle LED pin
}

void loop()
{
  // your program here...
}
Pages: [1] 2 3 4