Offline
Sr. Member
Karma: 4
Posts: 388
|
 |
« on: July 26, 2012, 06:39:35 am » |
hello everybody! Today I had some problems with a Infrared connection between two adruino boards. i don't want use the ken shriff librarie's. I' ve a phototransistor (2 pin) and a TSOP (3 pin). Can you help me to solve this problem? Thank a lot!!!
|
|
|
|
« Last Edit: July 26, 2012, 07:51:50 am by SUBSEA »
|
Logged
|
|
|
|
|
Leeds, UK
Offline
Newbie
Karma: 0
Posts: 29
|
 |
« Reply #1 on: July 26, 2012, 07:04:09 am » |
If you want any help, I suggest you indicate what the problem is, how it occurs, and what if anything you have tried.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Sr. Member
Karma: 4
Posts: 388
|
 |
« Reply #2 on: July 26, 2012, 07:17:18 am » |
thanks countrypaul for the answer! I want to turn on 4 led. For example: an arduino send '1': the 2 arduino reads '1' and turn on pin 13. it's impossible?
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Online
Brattain Member
Karma: 316
Posts: 35590
Seattle, WA USA
|
 |
« Reply #3 on: July 26, 2012, 07:21:29 am » |
For example: an arduino send '1': the 2 arduino reads '1' and turn on pin 13. it's impossible? No. But you have to define how you send a '1' with a phototransistor or TSOP. Then, you need to define how you receive data with a phototransistor or TSOP, and decide what it was you received.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Sr. Member
Karma: 4
Posts: 388
|
 |
« Reply #4 on: July 26, 2012, 07:50:46 am » |
I think a serial connection (if it is possible) like this, but the RX doesn't receve anything. my code is this: void setup(){ Serial.begin(9600); pinMode(13,OUTPUT); } void loop(){
if (Serial.available()>0){
if(Serial.read()=='2'){ digitalWrite(13, HIGH); } } }
void setup(){ Serial.begin(9600); pinMode(13,OUTPUT); } void loop(){ digitalWrite(13,HIGH); Serial.print('2'); }
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Online
Brattain Member
Karma: 316
Posts: 35590
Seattle, WA USA
|
 |
« Reply #5 on: July 26, 2012, 08:17:30 am » |
If you expect the IR transmitter to know how to do something useful to "send" a '2', I'm afraid you are sadly mistaken.
If you expect the IR receiver to know how to convert a bunch of blinking to a '2', I'm afraid you are sadly mistaken.
You have to make the IR transmitter flash in some specific way, usually modulated on top of a 38 MHz carrier, that means '2'.
You have to make the IR receiver demodulate the data from the 38 MHz carrier, and decode the HIGH/LOW times to determine that they mean '2'.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Sr. Member
Karma: 4
Posts: 388
|
 |
« Reply #6 on: July 26, 2012, 08:36:21 am » |
Thank a lot paulS. How can i do this?
|
|
|
|
|
Logged
|
|
|
|
|
Gosport, UK
Offline
Faraday Member
Karma: 19
Posts: 3117
|
 |
« Reply #7 on: July 26, 2012, 08:51:09 am » |
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Sr. Member
Karma: 4
Posts: 388
|
 |
« Reply #8 on: July 26, 2012, 09:06:14 am » |
Yes, something like this! But can turn on 4 different pin with those code?
|
|
|
|
|
Logged
|
|
|
|
|
Gosport, UK
Offline
Faraday Member
Karma: 19
Posts: 3117
|
 |
« Reply #9 on: July 26, 2012, 09:08:37 am » |
I see no reason why it couldn't be expanded to do that.
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Online
Brattain Member
Karma: 316
Posts: 35590
Seattle, WA USA
|
 |
« Reply #10 on: July 26, 2012, 09:12:00 am » |
But can turn on 4 different pin with those code? Depends on what you write the code to do. Given that that project appears to be able to send any data over serial, you could send "1", "two", "Tres" , and "Something A Bit Like Four", and then receive and interpret the data to know which pin to toggle. Of course, you could make the process easier by judicious choice of what to send.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Sr. Member
Karma: 4
Posts: 388
|
 |
« Reply #11 on: July 26, 2012, 03:13:57 pm » |
Ok. Thank a lot. only a question... What is this???: ) Mode bitWrite(TCCR1A, WGM10, 0); bitWrite(TCCR1A, WGM11, 0); bitWrite(TCCR1B, WGM12, 1); bitWrite(TCCR1B, WGM13, 0);
// Toggle OC1A and OC1B on Compare Match. bitWrite(TCCR1A, COM1A0, 1); bitWrite(TCCR1A, COM1A1, 0); bitWrite(TCCR1A, COM1B0, 1); bitWrite(TCCR1A, COM1B1, 0);
// No prescaling bitWrite(TCCR1B, CS10, 1); bitWrite(TCCR1B, CS11, 0); bitWrite(TCCR1B, CS12, 0);
OCR1A = 210; OCR1B = 210; I don't understand what it means... can you help me  ?
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 219
Posts: 13896
Lua rocks!
|
 |
« Reply #12 on: July 26, 2012, 04:34:37 pm » |
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Sr. Member
Karma: 4
Posts: 388
|
 |
« Reply #13 on: July 27, 2012, 02:41:23 am » |
ok, but i don't understand how i can send different messages... 
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 138
Posts: 19067
I don't think you connected the grounds, Dave.
|
 |
« Reply #14 on: July 27, 2012, 03:33:31 am » |
usually modulated on top of a 38 MHz carrier, sp. "38kHz"
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
|