Search found 15 matches

by yogotech
Tue Apr 28, 2020 10:32 pm
Forum: General Discussion and Questions
Topic: Pin interrupts and getting the value of the PIN state WHEN the ISR occurred
Replies: 16
Views: 683

Re: Pin interrupts and getting the value of the PIN state WHEN the ISR occurred

dhylands wrote:
Tue Apr 28, 2020 10:00 pm
Just to reiterate what others have said. You can't really sample the level inside the ISR Handler (even on the pyboard).
Unfortunately, due the nature of the data I'm capturing all the time, this means I really can't use MicroPython for my this particular project, which is too bad.
by yogotech
Tue Apr 28, 2020 9:11 pm
Forum: General Discussion and Questions
Topic: Pin interrupts and getting the value of the PIN state WHEN the ISR occurred
Replies: 16
Views: 683

Re: Pin interrupts and getting the value of the PIN state WHEN the ISR occurred

The way the signal is captured still applies. But I see that it isn't explained as well as I remember because I was messaging Peter a lot.. Basically you have to poll a 433MHz signal because interrupts are way too slow. at least on the ESPs. It's not though. I looked at the code, and it's a very di...
by yogotech
Tue Apr 28, 2020 9:04 pm
Forum: General Discussion and Questions
Topic: Pin interrupts and getting the value of the PIN state WHEN the ISR occurred
Replies: 16
Views: 683

Re: Pin interrupts and getting the value of the PIN state WHEN the ISR occurred

In my case, it's not a button, but a 433Mhz sensor, which receives a sequence of garbage data + valid data, so I have to play games to find the good data. Finding the good data means looking for specific patterns of events, and the events are determined the sequence of pulses. Regardless, even if i...
by yogotech
Tue Apr 28, 2020 8:17 pm
Forum: General Discussion and Questions
Topic: Pin interrupts and getting the value of the PIN state WHEN the ISR occurred
Replies: 16
Views: 683

Re: Pin interrupts and getting the value of the PIN state WHEN the ISR occurred

Given that you interrupt on each edge the pin state will alternate with each call to the ISR. If you know the pin state before the first interrupt occurs, you can therefore deduce it: pin_state = 1 # State before 1st interrupt occurs def isr(p): global pin_state pin_state ^= 1 # An interrupt has oc...
by yogotech
Tue Apr 28, 2020 4:09 pm
Forum: General Discussion and Questions
Topic: Pin interrupts and getting the value of the PIN state WHEN the ISR occurred
Replies: 16
Views: 683

Re: Pin interrupts and getting the value of the PIN state WHEN the ISR occurred

I tried the following, which seems to work. I sometimes get a couple of errors for the first couple of runs, but that's expected as I'm guessing the initial state, and I only have a 50% chance of guessing right. :) from machine import Pin import micropython from utime import sleep # Guess, will be ...
by yogotech
Tue Apr 28, 2020 3:53 pm
Forum: General Discussion and Questions
Topic: Pin interrupts and getting the value of the PIN state WHEN the ISR occurred
Replies: 16
Views: 683

Re: Pin interrupts and getting the value of the PIN state WHEN the ISR occurred

I tried the following, which seems to work. I sometimes get a couple of errors for the first couple of runs, but that's expected as I'm guessing the initial state, and I only have a 50% chance of guessing right. :) from machine import Pin import micropython from utime import sleep # Guess, will be w...
by yogotech
Tue Apr 28, 2020 3:45 pm
Forum: General Discussion and Questions
Topic: Pin interrupts and getting the value of the PIN state WHEN the ISR occurred
Replies: 16
Views: 683

Re: Pin interrupts and getting the value of the PIN state WHEN the ISR occurred

Given that you interrupt on each edge the pin state will alternate with each call to the ISR. If you know the pin state before the first interrupt occurs, you can therefore deduce it: pin_state = 1 # State before 1st interrupt occurs def isr(p): global pin_state pin_state ^= 1 # An interrupt has oc...
by yogotech
Tue Apr 28, 2020 3:35 am
Forum: General Discussion and Questions
Topic: Pin interrupts and getting the value of the PIN state WHEN the ISR occurred
Replies: 16
Views: 683

Pin interrupts and getting the value of the PIN state WHEN the ISR occurred

Background: I'm writing code in MicroPython to process data from a sensor that interrupts pretty quickly. However, I'm getting strange behavior in the ISR. I'm running the code on an ESP32, which if I write similar code in C works fine. Also similarly written C code works pretty well on a bone stock...
by yogotech
Fri Mar 06, 2020 12:06 am
Forum: Programs, Libraries and Tools
Topic: rshell - Remote Shell
Replies: 69
Views: 35611

Re: rshell - Remote Shell

The way I work is as follows. I use a programmers' editor (Kate) to edit a file, say myfile.py. Assume I want to run myfile.main(). From the directory containing the file I run rshell. Let's say the target is a Pyboard with an SD card. At the rshell prompt I issue path> cp myfile.py /sd repl >>> im...
by yogotech
Fri Mar 06, 2020 12:04 am
Forum: Programs, Libraries and Tools
Topic: rshell - Remote Shell
Replies: 69
Views: 35611

Re: rshell - Remote Shell

No joy. The above may be due to my unfamiliarity with python, as my simple example code is not a class per-se, but it should be easy to just 'run' the file similar to how ampy does. You also need to cp blink.py to the device. ARGH, it was on the device, but I must have fat-fingered it. :evil: Thank...