Тёмный

RPi 06 - Counter Using Interrupt 

tsbrownie
Подписаться 33 тыс.
Просмотров 6 тыс.
50% 1

Опубликовано:

 

22 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 16   
@geirha75
@geirha75 2 года назад
Thanks for a nice tutorial. I'm just wondering. Can your code be modified to count pulses from a anemometer? There are like 20 pules in one revolution.
@tsbrownie
@tsbrownie 2 года назад
Yes, but I find you need a dedicated device just to do that or the results are not very accurate. I have a few videos from this one to one about ultrasonic measurement, and they all have accuracy problems if you ask the microcontroller to do more than count.
@geirha75
@geirha75 2 года назад
@@tsbrownie One more question, tsbrownie. In your comment, the code, where # Pin 7 = 3,3V photodiode OFF. Maybe I don't get it, but how come the photodiode is off when detecting HIGH on pin 7? ( after interrupt on rising ).
@tsbrownie
@tsbrownie 2 года назад
@@geirha75 It's been a long time so I'm not sure, but if I remember correctly., it works backward from what you expect. It's an easy experiment to try both ways to see.
@jordigrau3625
@jordigrau3625 3 года назад
Just what i was looking for. Thank you so much.
@tsbrownie
@tsbrownie 3 года назад
You are welcome!
@jackparker596
@jackparker596 5 лет назад
Nice explanation. I didn't see where you declared 'channel'.
@tsbrownie
@tsbrownie 5 лет назад
Excellent point. The first parameter in the interrupt (the "7") is moved to the variable "channel".
@dukiiii
@dukiiii 4 года назад
GPIO.input(channel) > 0.5 Why 0.5 and not == 1? Isn't GPIO on RPi digital? Thank you!
@tsbrownie
@tsbrownie 4 года назад
Because > 0.5 is more inclusive than ==1. I got caught in school on a trick my teacher played and I never forgot it.
@dukiiii
@dukiiii 4 года назад
Just to be clear... There is no way that GPIO.input(channel) result be anything else except 0 or 1 (True/False), right? Can't be (in any circumstances) betveen 0 and 1?
@tsbrownie
@tsbrownie 4 года назад
It should be true or false (0 or 1). But since you don't know the logic / code behind the test, you can not say for sure there is "no way" for it to be other. Python is famous for its approximate math. I have some videos on that also. Why risk crashing a billion dollar lander over some little oddity in the code? It happens.
@dukiiii
@dukiiii 4 года назад
OK, that's fine answer! Thank you!
@johnathanbaker8453
@johnathanbaker8453 5 лет назад
Can this setup be used to input the "count" amount into a mysql database? If so could you demonstrate?
@tsbrownie
@tsbrownie 5 лет назад
Don't know, never tried it. Almost sounds like someone got a homework assignment. ;)
@codingwithalfred
@codingwithalfred 3 года назад
Wow... thinking outside the box... The only way i can think of achieving this will be to print the count to serial, then use some kind of application to stream/save the serial data to mysql database.
Далее
Raspberry Pi: Using GPIO Inputs
18:41
Просмотров 583 тыс.
RPi 05 - Detect Input Using Interrupts
8:02
Просмотров 9 тыс.
Why is it different from what I thought?
00:15
Просмотров 848 тыс.
RPi 34.0 - Hall Effect Tachometer (4K)
10:48
Просмотров 7 тыс.
Just enough assembly to blow your mind
29:31
Просмотров 106 тыс.
How Raspberry Pis are made (Factory Tour)
14:17
Просмотров 636 тыс.
I Can Save You Money! - Raspberry Pi Alternatives
15:04
Why is it different from what I thought?
00:15
Просмотров 848 тыс.