Transmitter and receiver #284
Replies: 5 comments
-
Posted at 2014-06-16 by @gfwilliams Basically what's happening is rather than storing the data in an array or a string, it's being stored in a number (as binary). There are probably some tutorials about it online... While it could be done another way, it's faster and more efficient this way - and it's nearer to what the normal socket's receiver and transmitter is doing internally. The line:
could be rewritten as:
Note that replacing the What it's doing is turning the data it is receiving into a number, one bit at a time. So what sigOff does is:
And in sigOn:
Hope that helps... Let me know if you have any other questions... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-06-17 by Pumych It helps a lot. Thank you very much. So if understood right, it doesn't matter how much time the signal was in "0" state (if it was less than 5ms)? PS: steps in e.time are the same 10 steps as in table, I think it not looks good on the image.Attachments: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-06-17 by Pumych Now I trying to understand the transmitter functionality.
what we trying to put in "bits"? If I understand correctly, this part
always returns our "CODE" with five right zeros, what for? In setWatch() :
we switch between 0 and 1, what for? Is there some reason for? Thank you in advance. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-06-18 by @gfwilliams For the receiver, for the remote control I used, the time the signal was 0 doesn't matter so it isn't measured (it's the opposite of the time the signal is 1). If you were using a different brand of remote control socket then it could be different... For:
You're correct - it makes the last 5 bits of the code zero, and then it adds in the command. This is because the last 5 bits contain the command code. They could have just been zeroed when
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-06-18 by Pumych Got it, thank you. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2014-06-16 by Pumych
Playing around with REMOTE CONTROL SOCKETS .
Wired transmitter and receiver, and its sends and receives the bits on pressing BTN but I trying to understand the whole code:
In this function
what is the meaning of bold code
n = (n<<1) | ((d>=0.0004)?1:0);
I mean what doing "<<" sign and "|" one (it's not the same as "||" in JavaScript?)
Can you please add a link for reference for those signs in JS (or not JS)?
EDIT:
Found it here but still little confused to understand the sigOn() and sigOff() functions. Can someone please add step-by-step explanations for those functions or add new ones but with simple code?
Beta Was this translation helpful? Give feedback.
All reactions