顯示具有 arduino 標籤的文章。 顯示所有文章
顯示具有 arduino 標籤的文章。 顯示所有文章

2021年6月9日 星期三

[Arduino]2 Relay Module

 不錯的文章:

Interface Two Channel Relay Module with Arduino
https://lastminuteengineers.com/two-channel-relay-module-arduino-tutorial/

relay spec:
http://j5d2v7d7.stackpathcdn.com/wp-content/uploads/2015/10/SRD-05VDC-SL-C-Datasheet.pdf

2021年3月25日 星期四

[arduino]Bluetooth(zs-040)



藍芽模組的LED燈號:
連續的快閃:藍芽等待配對中。   --->bluetooth板子的EN腳接地 --->手機可搜尋到裝置
連續的快閃2下後停1下:藍芽已配對成功,運作中。
連續慢速閃爍(約兩秒一次):藍芽已進入AT模式,準備設定。 -->-->bluetooth板子的EN腳3.3V




不錯的文章

藍牙模組(HC05、HC06)常見的指令使用教學
https://blog.cavedu.com/2017/10/18/hc05-hc06/

HC-05藍芽連線
https://sites.google.com/a/ntut.org.tw/jimmyhu/projectlist/hc-05-bluetooth-connect

2021年3月16日 星期二

[arduino]NFC PN532 module

 

不錯的文章

https://ithelp.ithome.com.tw/articles/10220398

PN532 NFC RFID Module
http://wiki.sunfounder.cc/index.php?title=PN532_NFC_RFID_Module

2020年12月24日 星期四

[Arduino] GP2Y1010AU0F 灰塵感測器檢測PM2.5


網路找到的資料:




不錯的文章:

GP2Y1010AU0F 灰塵感測器檢測PM2.5
https://atceiling.blogspot.com/2019/10/arduino73-gp2y1010au0f-pm25.html

GP2Y1010AU0F 灰塵感測
https://sites.google.com/site/csjhmaker/e0/gp2y1010au0f-hui-chen-gan-ce

2018年1月28日 星期日

[Arduino]Visual Studio 當作 Arduino IDE進行開發Arduino

不錯的文章:

使用 Visual Studio 當作 Arduino IDE進行開發Arduino
https://dotblogs.com.tw/jason_wang/2016/01/02/visual-studio_for_arduino

2017年12月1日 星期五

[arduino Mega2560]I2C 練習

看到文章說,最大只能傳送32 bytes,有看到說更改底層的define就可使用超過 32 bytes
而這邊是為了要讀取64 bytes因為是練習,所以就把他拆而兩次讀,重點是要了解其I2C R/W程式寫法:

參考:
https://www.arduino.cc/en/Reference/Wire




#include <Wire.h>

bool send_step1_ok_flag;
bool send_step2_ok_flag;

byte buffer[64];
byte buffer_count;
byte slave_address=0x55;

void setup()
{
  Serial.begin(9600);

  while(!Serial) ;

  Serial.println("Serail port working...");

  send_step1_ok_flag=false;
  send_step2_ok_flag=false;

  Wire.begin();
}

void I2C_cmd_send(byte start_address)
{
  byte length=32;
  Wire.beginTransmission(slave_address);
  Wire.write(start_address);
  Wire.endTransmission();
  Wire.requestFrom(slave_address,length);
}

void loop()
{
  if((!send_step1_ok_flag)&&(!send_step2_ok_flag))
  {
    Serial.println("Master Send I2C cmd");
    send_step1_ok_flag=true;
    I2C_cmd_send(0);
    buffer_count=0;
  }
  else if((send_step1_ok_flag)&&(!send_step2_ok_flag))
  {
    if(buffer_count==32)
    {
      send_step2_ok_flag=true;
      I2C_cmd_send(32);
    }
  }
  else
  {
        Serial.println("Master Read finish");
      for(byte i=0;i<64;i++)
      {
        Serial.print(buffer[i],HEX);
        Serial.print(" ");
      }
      Serial.println();
   
      send_step1_ok_flag=false;
      send_step2_ok_flag=false;
       delay(1000);
     
  }

  while(Wire.available())
  {
    buffer[buffer_count]=Wire.read();
    buffer_count=buffer_count+1;
  }

}