好評を博したArduino用の多機能シールドCLCD-BOOSTER-R3の後継機種として開発しました。
ご目的に応じてR3とR4の適切なボードをご利用ください。
Arduino UNO/MEGA R3に対応しています。
CLCD-BOOSTER-R4は、Arduinoの入出力として広く使用されているLED、タクトスイッチ、文字液晶表示装置、圧電サウンダを搭載しており、初心者がArduinoの学習を始めるのに大変適しています。
さらに、環境センサーBME280、超音波距離センサー、リアルタイムクロックを搭載できるだけでなく、RCサーボ、NeoPixelカラーLED、焦電(人感)センサーなどを接続できるようになっており、様々な発展的な実験のプラットフォームとして利用できるようになっています。
CLCD-BOOSTER-R4は豊富な入出力を利用することができるため、Blynkを利用することにより、最近注目されているIoTの実験にも効果的に利用することができます。
CLCD-BOOSTER-R4の組み立て例
CLCD-BOOSTER-R4の特徴を以下に示します。
ネットショップ:
Arduino UNOへの接続例
#include <LiquidCrystal.h> // CLCD-BOOSTER-R4の文字液晶のピン配置に対応 LiquidCrystal clcd(9, 7, 10, 11, 12, 13) ; void setup() { clcd.begin(16, 2) ; clcd.setCursor(4, 0) ; clcd.print("CLCD-BOOSTER") ; clcd.setCursor(1, 1) ; clcd.print("Hello! MicroFan") ; delay(3000) ; } void loop() { // 明るさセンサーの読み取り int bright = analogRead(0) ; clcd.setCursor(0, 1) ; clcd.print("Brightness: ") ; clcd.setCursor(12, 1) ; clcd.print(" ") ; clcd.setCursor(12, 1) ; clcd.print(bright) ; delay(500) ; }
#include <LiquidCrystal.h> #define SW1 2 #define SW2 3 #define SW3 4 // CLCD-BOOSTER-R4の文字液晶のピン配置に対応 LiquidCrystal clcd(9, 7, 10, 11, 12, 13) ; void setup() { clcd.begin(16, 2) ; clcd.setCursor(4, 0) ; clcd.print("CLCD-BOOSTER") ; clcd.setCursor(1, 1) ; clcd.print("Hello! MicroFan") ; // スイッチはプルアップ付きで初期化 pinMode(SW1, INPUT_PULLUP) ; pinMode(SW2, INPUT_PULLUP) ; pinMode(SW3, INPUT_PULLUP) ; delay(3000) ; } void loop() { char buff[] = " ___ ___ ___ " ; if (digitalRead(SW1) == LOW) { buff[2] = '*' ; buff[3] = '*' ; buff[4] = '*' ; } if (digitalRead(SW2) == LOW) { buff[6] = '*' ; buff[7] = '*' ; buff[8] = '*' ; } if (digitalRead(SW3) == LOW) { buff[10] = '*' ; buff[11] = '*' ; buff[12] = '*' ; } clcd.setCursor(0,1) ; clcd.print(buff) ; delay(500) ; }
#include <LiquidCrystal.h> #define SW1 2 #define SW2 3 #define SW3 4 #define SOUNDER 8 LiquidCrystal clcd(9, 7, 10, 11, 12, 13) ; void setup() { clcd.begin(16, 2) ; clcd.setCursor(4, 0) ; clcd.print("CLCD-BOOSTER") ; clcd.setCursor(1, 1) ; clcd.print("Hello! MicroFan") ; pinMode(SW1, INPUT_PULLUP) ; pinMode(SW2, INPUT_PULLUP) ; pinMode(SW3, INPUT_PULLUP) ; } void loop() { int hz = 0 ; if (digitalRead(SW1) == LOW) hz += 200 ; if (digitalRead(SW2) == LOW) hz += 400 ; if (digitalRead(SW3) == LOW) hz += 800 ; if (hz != 0) tone(SOUNDER, hz) ; else noTone(SOUNDER) ; delay(100) ; }
#include <LiquidCrystal.h> LiquidCrystal clcd(9, 7, 10, 11, 12, 13) ; #define USDS_TRIG 16 #define USDS_ECHO 17 #define USDS_TIMEOUT (100*1000L) // us #define ONSOKU (340.0*100) // cm void setup() { clcd.begin(16, 2) ; clcd.print("") ; pinMode(USDS_TRIG, OUTPUT) ; digitalWrite(USDS_TRIG, LOW) ; pinMode(USDS_ECHO, INPUT) ; } void loop() { int duration ; float distance ; digitalWrite(USDS_TRIG, HIGH) ; delayMicroseconds(10) ; digitalWrite(USDS_TRIG, LOW) ; duration = pulseIn(USDS_ECHO, HIGH, USDS_TIMEOUT) ; if (duration > 0) { // 音速: 340m/s = 34000cm/s = 0.034cm/us distance = duration / 2.0 * ONSOKU / 1000000 ; clcd.clear() ; clcd.print(duration) ; clcd.print(" us ") ; clcd.setCursor(0, 1) ; clcd.print(distance) ; clcd.print(" cm") ; } delay(500) ; }
#include <LiquidCrystal.h> #include <BME280I2C.h> LiquidCrystal clcd(9, 7, 10, 11, 12, 13) ; BME280I2C bme ; #define PRESSURE_HPA 1 // ヘクトパスカル void setup () { clcd.begin(16, 2) ; while (!bme.begin()) { clcd.print("BME280 Con...") ; delay(500) ; clcd.clear() ; delay(500) ; } } void loop () { float temp ; // 温度 float hum ; // 湿度 float pres ; // 気圧 // 気圧(hPa)、温度(摂氏)、湿度を取得 bme.read(pres, temp, hum, true, PRESSURE_HPA) ; clcd.clear() ; clcd.print(temp) ; clcd.print("C, ") ; clcd.print(hum) ; clcd.print("RH%") ; clcd.setCursor(0, 1) ; clcd.print(pres) ; clcd.print(" hPa") ; delay(1000) ; }
#include <LiquidCrystal.h> #include <Wire.h> #include <RtcDS3231.h> LiquidCrystal clcd(9, 7, 10, 11, 12, 13) ; RtcDS3231 Rtc ; void setup () { Rtc.Begin() ; // DS3231の日時を「それなりの値」に設定する場合に、以下の2行をコメントアウト // RtcDateTime compiled = RtcDateTime(__DATE__, __TIME__) ; // Rtc.SetDateTime(compiled) ; clcd.begin(16, 2) ; } void loop () { char buff[12] ; RtcDateTime dt = Rtc.GetDateTime() ; sprintf(buff, "%04u/%02u/%02u", dt.Year(), dt.Month(), dt.Day()) ; clcd.setCursor(0, 0) ; clcd.print(buff) ; sprintf(buff, " %02u:%02u:%02u", dt.Hour(), dt.Minute(), dt.Second()) ; clcd.setCursor(0, 1) ; clcd.print(buff) ; delay(100) ; }
CLCD-BOOSTER-R4の回路図を示します。
CLCD-BOOSTER-R4の回路図