United Kingdom
Offline
Faraday Member
Karma: 130
Posts: 4643
|
 |
« Reply #15 on: December 12, 2012, 03:48:22 am » |
I tried this but that didn't work. Allthough I doubt I did it right. Am I looking for a char to integer converter or something else? Sensor1Data = atoi(buf); Error Message conversion from 'uint8_t*' to 'const char*' rgb_mixer_RF_controlled_pulse_makkan_v4_ino:115: error: initializing argument 1 of 'int atoi(const char*)' Try: Sensor1Data = atoi((const char*)buf);
|
|
|
|
|
Logged
|
Formal verification of safety-critical software, software development, and electronic design and prototyping. http://www.eschertech.com
|
|
|
|
Gothenburg, Sweden
Offline
Jr. Member
Karma: 0
Posts: 94
Excellent!
|
 |
« Reply #16 on: December 12, 2012, 04:07:29 am » |
Try: Sensor1Data = atoi((const char*)buf); That compiled, as I suspect you already knew. Unfortunately I will have to wait a couple of hours before I can try it live. However as I do like to know what I'm coding could you please tell me or point me in a good direction to find reading material as to what actually is done in that line. Am I just stating that buf is a const char* or does (const char*)buf perform some sort of change?
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 137
Posts: 19003
I don't think you connected the grounds, Dave.
|
 |
« Reply #17 on: December 12, 2012, 04:35:46 am » |
Am I just stating that buf is a const char* or does (const char*)buf perform some sort of change? You're just telling the compiler that you want the pointer to "buf" to be treated as though it were a "const char*", even though you know it is a pointer to a different type. Because it is a pointer to a datatype with the same size, this is normally perfectly OK, particularly as in this case, where the buffer simply contains ASCII data.
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Gothenburg, Sweden
Offline
Jr. Member
Karma: 0
Posts: 94
Excellent!
|
 |
« Reply #18 on: December 12, 2012, 11:17:22 am » |
Try: Sensor1Data = atoi((const char*)buf); Sorry to say I got the same problem as before. A couple of lines fly by in the Serial Monitor before it hangs. Commenting out the Serial.print lines does not help either. Again if I don't include the colorControl(); function everything seems to work just fine.
|
|
|
|
|
Logged
|
|
|
|
|
United Kingdom
Offline
Faraday Member
Karma: 130
Posts: 4643
|
 |
« Reply #19 on: December 12, 2012, 11:36:17 am » |
Again if I don't include the colorControl(); function everything seems to work just fine.
Ah, I missed that bit. The version of VirtualWire I am looking at (1.9) uses timer 1. That means that you can't use PWM on pins 9 and 10.
|
|
|
|
|
Logged
|
Formal verification of safety-critical software, software development, and electronic design and prototyping. http://www.eschertech.com
|
|
|
|
Gothenburg, Sweden
Offline
Jr. Member
Karma: 0
Posts: 94
Excellent!
|
 |
« Reply #20 on: December 12, 2012, 02:50:22 pm » |
Ok, so I've changed the ledpins to use pin 3, 5 and 6. This actually stops Serial Monitor output from hanging. But it still seems to hang after a while when the Sensor1Data gets stuck with the same number.
|
|
|
|
|
Logged
|
|
|
|
|
United Kingdom
Offline
Faraday Member
Karma: 130
Posts: 4643
|
 |
« Reply #21 on: December 12, 2012, 02:58:15 pm » |
But it still seems to hang after a while when the Sensor1Data gets stuck with the same number.
Perhaps the device is no longer receiving data over VirtualWire then? In which case, either receiving has stopped, or the other device has stopped sending data. You need to determine which.
|
|
|
|
|
Logged
|
Formal verification of safety-critical software, software development, and electronic design and prototyping. http://www.eschertech.com
|
|
|
|
Gothenburg, Sweden
Offline
Jr. Member
Karma: 0
Posts: 94
Excellent!
|
 |
« Reply #22 on: December 12, 2012, 04:25:47 pm » |
It's the receiver that stops receiving. And it seems it is colorControl() that somehow mixes things up. If I just comment that one out, I can go on for ages.
|
|
|
|
|
Logged
|
|
|
|
|
United Kingdom
Offline
Faraday Member
Karma: 130
Posts: 4643
|
 |
« Reply #23 on: December 12, 2012, 05:09:31 pm » |
What happens if you just comment out the analogWrite calls?
|
|
|
|
|
Logged
|
Formal verification of safety-critical software, software development, and electronic design and prototyping. http://www.eschertech.com
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 311
Posts: 35470
Seattle, WA USA
|
 |
« Reply #24 on: December 13, 2012, 07:06:38 am » |
You appear to still have your LEDs connected to pins 9 and 10, which the VirtualWire class uses, unless you tell it to use other pins. Which you don't.
So, it's hardly surprising that as soon as you write to those pins VirtualWire quits working.
|
|
|
|
|
Logged
|
|
|
|
|
Gothenburg, Sweden
Offline
Jr. Member
Karma: 0
Posts: 94
Excellent!
|
 |
« Reply #25 on: December 13, 2012, 11:09:42 am » |
You appear to still have your LEDs connected to pins 9 and 10, which the VirtualWire class uses, unless you tell it to use other pins. Which you don't.
So, it's hardly surprising that as soon as you write to those pins VirtualWire quits working.
Nope, dc42 noted this a while back so I've changed to pins 3,5 and 6. What happens if you just comment out the analogWrite calls?
That works, it's up and running hand still works after five minutes of continous running. So it seems to be analogWrite that causes trouble.
|
|
|
|
|
Logged
|
|
|
|
|
United Kingdom
Offline
Faraday Member
Karma: 130
Posts: 4643
|
 |
« Reply #26 on: December 13, 2012, 11:48:42 am » |
OK, try commenting just one or two of the analogWrite calls out, see if it is a particular pin causing the trouble.
|
|
|
|
|
Logged
|
Formal verification of safety-critical software, software development, and electronic design and prototyping. http://www.eschertech.com
|
|
|
|
Gothenburg, Sweden
Offline
Jr. Member
Karma: 0
Posts: 94
Excellent!
|
 |
« Reply #27 on: December 13, 2012, 12:37:44 pm » |
That didn't do much but I noticed that if I disconnected the led everything worked. Could it be that the led disturbs the transmission?
|
|
|
|
|
Logged
|
|
|
|
|
United Kingdom
Offline
Faraday Member
Karma: 130
Posts: 4643
|
 |
« Reply #28 on: December 13, 2012, 02:34:02 pm » |
Post a photo and schematic of your setup. Maybe the ground wiring needs attention. What value resistors do you have in series with the LEDs?
|
|
|
|
|
Logged
|
Formal verification of safety-critical software, software development, and electronic design and prototyping. http://www.eschertech.com
|
|
|
|
|
|
|