Arduino¶
Arduino.ino sample です。src/sketch_feb25a.ino に、ソースコードの例を示します。
強調したい場合、たとえば
ソースコード make
は、このようになります。$ hoge
のようになります。
Conclusion が、結論への内部参照リンクになります。
Conclusion が、結論への内部参照リンクになります。
src/sketch_feb25a.ino¶
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
src/factorytest.ino¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include "M5StickCPlus.h"
#include "fft.h"
#include "esp_pm.h"
#include <rom/crc.h>
#include <driver/i2s.h>
#include <driver/rmt.h>
#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>
typedef struct
{
point_3d_t start_point;
point_3d_t end_point;
} line_3d_t;
typedef struct
{
double x;
double y;
} point_2d_t;
|
これらのソースコードは、ファイルから直接差し込むほうが、間違いは少ないと思われます。
src/analogread.ino¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include <M5StickCPlus.h>
int PIN = 26;
// +--- 15kΩ抵抗 --+-- CdSセル --+
// | | |
// GND G26 3V3
// https://www.storange.jp/2012/03/arduinocds.html
// 注意点: https://lang-ship.com/reference/unofficial/M5StickC/Peripherals/ADC/
void setup() {
M5.begin();
pinMode(PIN, ANALOG); // PINのモード設定
// https://lang-ship.com/blog/work/m5stickc-io/
}
void loop() {
Serial.printf("%04d\n", analogRead(PIN) ); // 暗 0〜4095 明
delay(1000);
}
|