-
Notifications
You must be signed in to change notification settings - Fork 224
Add 433 MHz transmitter example #772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
can you add example how to receive the data? |
This example works with a simple transmit only board. I haven't used a receiver yet, but I can see if I can also make it work. Would you split this in two examples or put both in one? |
|
if the code is too big, I would split it into 2 if not one is ok i think. |
|
Is it possible to do both send and receive from one part? If so, that would be best. And I am glad you kept things simple, but I do think the minimum viable product would be both send and receive. |
|
So definitely not a no, @sodoku but, maybe a "when you get TX/RX going. Other than that the PR is good. |
|
@cnlohr I managed to solder my receiver antenna and play around a bit with it. Reading how rc-switch does the receive and looking through the ch32fun examples, it looks like I will need to use interrupts for the input data change detection and for being able to measure time difference ( |
|
@sodoku on ch32fun, you use uint32_t start_time = SysTick->CNT;
while( 1 )
{
// Do stuff
if( TimeElapsed32( SysTick->CNT, start_time ) >= Ticks_from_Ms(150) )
{
// 150ms elapsed.
start_time += Ticks_from_Ms(150);
}
} |
|
I spent hours on this and learned a lot, but somehow the timing values didn't make sense. I am not sure what I am doing wrong. I boiled my problem down to a very simple example: int miliseconds = 15000;
uint32_t start_time = SysTick->CNT;
while ( 1 )
{
// Do stuff
uint32_t diff = TimeElapsed32( SysTick->CNT, start_time );
if ( diff >= Ticks_from_Us( miliseconds ) )
{
start_time += Ticks_from_Us( miliseconds );
printf( "%lu \n", diff / DELAY_US_TIME );
}
}This works an outputs: However if I change What am I doing wrong? |
I was playing around with 433Mhz and thought this might help someone. Feel free to reject if this is too basic.