此程式碼使用TIME函數,利用呼叫副程式的方式,來達到同步,因此省去delay,避免子程式互相延遲的問題。總共有4個子程式,分別是夜光燈、底部呼吸燈與2個音樂撥放程式。程式撰寫與測試的時間差不多2天。

#include <Arduino.h>
#include <SoftwareSerial.h>
#include "Garan.h"
#include "Timer.h"

兩隻小豬 發表在 痞客邦 留言(0) 人氣()

#include <SoftwareSerial.h>
#define _baudrate 9600
#define _rxpin 4
#define _txpin 5
SoftwareSerial debug( _rxpin, _txpin ); // RX, TX

兩隻小豬 發表在 痞客邦 留言(0) 人氣()

#include <SoftwareSerial.h>
#define _baudrate 9600
#define _rxpin 4
#define _txpin 5
SoftwareSerial debug( _rxpin, _txpin ); // RX, TX

兩隻小豬 發表在 痞客邦 留言(0) 人氣()

#include <SoftwareSerial.h>
SoftwareSerial mySerial(4, 5); // Arduino RX:4, TX:5
void setup()
{
// Open serial communications and wait for port to open:

兩隻小豬 發表在 痞客邦 留言(1) 人氣()

#include <SoftwareSerial.h>
#define _baudrate 9600
#define _rxpin 4
#define _txpin 5
#include "Timer.h"

兩隻小豬 發表在 痞客邦 留言(0) 人氣()

#include <Arduino.h>
#include <SoftwareSerial.h>
#include "Timer.h"
#include <LiquidCrystal.h>
Timer t;

兩隻小豬 發表在 痞客邦 留言(0) 人氣()

#include <SoftwareSerial.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include "Timer.h"
SoftwareSerial I2CBT(8,9); //Tx & Rx

兩隻小豬 發表在 痞客邦 留言(0) 人氣()

#include <SoftwareSerial.h>
#include <Wire.h>
#include "Timer.h"
#include <LiquidCrystal.h>
SoftwareSerial I2CBT(8,9); //Tx & Rx

兩隻小豬 發表在 痞客邦 留言(0) 人氣()

1
Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。