RASPI::ALL EXCEPT KALUMA, RASPICO/W::MPY,KALUMA, UNOR3/NANO:JOHNNY5,DOLITTLE
ESP32/ESP8266/ESP01::この機種ではARDUINO IOT CLOUDができそう。。。
MICROBIT/OBNIZ::BLE通信相互にできそう。。。。
UNO R4 WIFI いまんところARDUINO LANGだけ可能(MIT APP INVENTORともども勉強)
------------ble3---------------------------------------------------------------
https://docs.sunfounder.com/projects/elite-explorer-kit/ja/latest/iot_projects/08_iot_ble_home.html 成功
BLEの具体的内容はMIT APP INVENTORで学ぶ!
ちなみにIFTTTはGMAILが機能廃止されてた!LineNotifyも同様!
--------------------------------------------------------------------------------------
oledはi2c版をもちいた(元本ではSPI.hが引用されているが動いた)5v駆動であった
ーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
https://newbiely.com/tutorials/arduino-uno-r4/arduino-uno-r4-button-debounce
インプットをPin7にしてボタンを介してGNDにつなぐ
#define BUTTON_PIN 7 // The Arduino UNO R4 pin connected to the button
#define DEBOUNCE_TIME 50 // The debounce time; increase if the output flickers
int last_steady_state = LOW; // the previous steady state from the input pin
int last_flickerable_state = LOW; // the previous flickerable state from the input pin
int current_state; // the current reading from the input pin
unsigned long last_debounce_time = 0; // the last time the output pin was toggled
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
// initialize the pushbutton pin as a pull-up input
pinMode(BUTTON_PIN, INPUT_PULLUP);
}
void loop() {
// read the state of the switch/button:
current_state = digitalRead(BUTTON_PIN);
// If the switch/button changed, due to noise or pressing:
if (current_state != last_flickerable_state) {
// reset the debouncing timer
last_debounce_time = millis();
// save the the last flickerable state
last_flickerable_state = current_state;
} この部分でチャタリング対策している
if ((millis() - last_debounce_time) > DEBOUNCE_TIME) {
// if the button state has changed:
if (last_steady_state == HIGH && current_state == LOW)
Serial.println("The button is pressed");
else if (last_steady_state == LOW && current_state == HIGH)
Serial.println("The button is released");
// save the the last steady state
last_steady_state = current_state;
}
}
----------------------------------------------------------------------
photoresistorの値をしらべるのに段階的に照度を調整できるライトが必要
leedをanalogWriteしてみればいいと思う
ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
0 件のコメント:
コメントを投稿