diff --git a/docs/en/unit/dac.md b/docs/en/unit/dac.md index 4ee9a51b..7e46c535 100644 --- a/docs/en/unit/dac.md +++ b/docs/en/unit/dac.md @@ -10,7 +10,7 @@ ## Description -**DAC** is a unit can convert digital signal to analog signal like voltage waveform, audio waveform and so on. It integrates a 12-bit high resolution DAC chip named **MCP4725** which integrates a on-board non-volatile memory (EEPROM). The unit comunicates with M5Core with I2C. The DAC input and configuration data can be programmed to the EEPROM. +**DAC** is a unit can convert digital signal to analog signal like voltage waveform, audio waveform and so on. It integrates a 12-bit high resolution DAC chip named **MCP4725** which integrates a on-board non-volatile memory (EEPROM). The unit comunicates with M5Core with I2C. The DAC input and configuration data can be programmed to the EEPROM. I2C address is 0x60. ## Feature diff --git a/docs/ja/unit/angle.md b/docs/ja/unit/angle.md index 7d0ebcea..009899ab 100644 --- a/docs/ja/unit/angle.md +++ b/docs/ja/unit/angle.md @@ -4,59 +4,26 @@ *** -:memo:**[概要](#概要)**      :octocat:**[サンプルコード](#サンプルコード)**       :electric_plug:**[回路図](#回路図)**       🛒**[購入リンク](#購入リンク)** +:memo:**[概要](#概要)**      :octocat:**[サンプルコード](#サンプルコード)**       :electric_plug:**[回路図](#回路図)**       🛒**[購入リンク](https://www.aliexpress.com/item/M5Stack-Official-Mini-Angle-Unit-Potentiometer-Inside-Resistance-Adjustable-GPIO-GROVE-Co-n-nec-to-r/32931834705.html)** ## 概要 -**ANGLE**ユニットは可変抵抗器です。回転角度検出や音量調節などに利用できます。 +**ANGLE**ユニットはは10Kポテンショメータと呼ばれる抵抗器を搭載したユニットです。ポテンショメータは3端子の抵抗素子で、つまみを回すことで抵抗値を調整できます。ポテンショメータが回転すると、出力電圧値(Uo)が変化します。モーター速度、LEDの明るさなどの調整に使用できます。抵抗値の変化を下図に示します。 + + + +M5CoreのGROVE Bインターフェースに接続して、利用可能です。 ## 特徴 -- サポート[UIFlow](http://flow.m5stack.com)プログラミング, [Arduino](http://www.arduino.cc)プログラミング +- 出力電圧範囲: 0 ~ 2500mV +- [UIFlow](http://flow.m5stack.com)、[Arduino](http://www.arduino.cc)プログラミングサポート - LEGO 互換ホール -## サンプルコード +## パッケージ内容 -### 1. Arduino IDE - -*以下のコードは不完全です(説明のためだけに). 完全なコードが必要な場合は、ここをクリックしてください[サンプルコード](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/ANGLE/Arduino).* - -```arduino -#include - -// select the input pin for the potentiometer -#define sensorPin 36 - -// declaration -int cur_sensorValue = 0; - -// initialization -M5.begin(); -pinMode(sensorPin, INPUT); - -// read data -cur_sensorValue = analogRead(sensorPin); -``` - - - -### 2. UIFlow - -*特定のルーチンについてはここをクリックしてください[サンプルコード](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/ANGLE/UIFlow).* - - - -## 回路図 - - - -### ピンマッピング - - -
- - -
M5Core(GROVEインターフェースB)GPIO36GPIO265VGND
角度センサーUnitセンサーピン 5VGND
+- 1x ANGLEユニット +- 1x Groveケーブル ## 関連リンク @@ -64,6 +31,59 @@ cur_sensorValue = analogRead(sensorPin); - **[フォーラム](http://forum.m5stack.com/)** -## 関連情報 +## サンプルコード -- [ANGLE ユニット 購入(AliExpress)](https://www.aliexpress.com/store/product/M5Stack-GPIO-Co-n-nec-to-r/3226069_32931834705.html) \ No newline at end of file +### 1. Arduino IDE + +*完全なソースコードは[こちら](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/ANGLE/Arduino)。* + +画面にユニット出力電圧値に対応するデジタル値を表示します。 範囲は0~4095です。 + +```arduino +#include +// select the input pin for the potentiometer +int sensorPin = 36; +// last variable to store the value coming from the sensor +int last_sensorValue = 0; +// current variable to store the value coming from the sensor +int cur_sensorValue = 0; + +void setup() { + M5.begin(); + pinMode(sensorPin, INPUT); + M5.Lcd.setTextSize(2); + M5.Lcd.setCursor(0, 0); + M5.Lcd.print("the value of ANGLE: "); +} + +void loop() { + // read the value from the sensor: + cur_sensorValue = analogRead(sensorPin); + M5.Lcd.setCursor(0, 25); + if(abs(cur_sensorValue - last_sensorValue) > 10){//debaunce + M5.Lcd.fillRect(0, 25, 100, 25, BLACK); + M5.Lcd.print(cur_sensorValue); + last_sensorValue = cur_sensorValue; + } + delay(50); +} +``` + + + +### 2. UIFlow + +*完全なソースコードは[こちら](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/ANGLE/UIFlow)。* + + + +## 回路図 + + + +### ピンマップ + + + + +
M5Core(GROVE B)GPIO36GPIO265VGND
ANGLE UnitSensor Pin 5VGND
diff --git a/docs/ja/unit/dac.md b/docs/ja/unit/dac.md index 17f8cd7d..3371dbc4 100644 --- a/docs/ja/unit/dac.md +++ b/docs/ja/unit/dac.md @@ -8,69 +8,69 @@ ## 概要 -**DAC**ユニットは電圧や音などのデジタル信号をアナログ信号に変換する機能を提供します。12 bitの分解能を持つMCP4725チップを採用しており、入力値やコンフィグレーションデータは内蔵する不揮発性メモリ(EEPROM)に書き込む事が可能です。 +**DAC**ユニットはデジタル信号を電圧波形、音声波形などのアナログ信号に変換することができます。 MCP4725という12ビットの高分解能DACチップを内蔵しています。このチップには不揮発性メモリ(EEPROM)が内蔵されており、DAC入力や設定データをEEPROMに書き込むことができます。このユニットはI2Cで制御することができます。I2Cアドレスは**0x60**です。 ## 特徴 - 最大12bit 分解能 - 出力電圧 0 ~ 3.3V - LEGO 互換ホール -- EEPROM +- EEPROM内蔵 + +## パッケージ内容 + +- 1x DACユニット +- 1x Groveケーブル ## アプリケーション -- MP3 オーディオプレイヤー +- MP3オーディオプレイヤー - ミニオシロスコープ -## ドキュメント +## 関連リンク -- **GitHub** - - [Arduino](https://github.com/m5stack/M5Stack/tree/master/examples/Unit/DAC_MCP4725) +- **[公式ビデオ](https://www.youtube.com/channel/UCozgFVglWYQXbvTmGyS739w)** -- **データシート** +- **[フォーラム](http://forum.m5stack.com/)** + +- **データシート** - [MCP4725](http://pdf1.alldatasheet.com/datasheet-pdf/view/233449/MICROCHIP/MCP4725.html) ## サンプルコード ### 1. Arduino IDE -*以下のコードは不完全です(説明のためだけに). 完全なコードが必要な場合は、ここをクリックしてください[サンプルコード](https://github.com/m5stack/M5Stack/tree/master/examples/Unit/ADC_ADS1100).* +*完全なソースコードは[こちら](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/DAC/Arduino)。* ```arduino -#include +/* + hardware : m5stack uint dac + please install adafruit MCP4725 lib +*/ #include -#include "ADS1100.h" +#include -// declaration -byte error; -int8_t address; - -//new a object -ADS1100 ads; +// new a object +Adafruit_MCP4725 dac; // initialization -M5.begin(true, false, false); -ads.getAddr_ADS1100(ADS1100_DEFAULT_ADDRESS);// 0x48, 1001 000 (ADDR = GND) -ads.setGain(GAIN_ONE); // 1x gain(default) -ads.setMode(MODE_CONTIN); // Continuous conversion mode (default) -ads.setRate(RATE_8); // 8SPS (default) -ads.setOSMode(OSMODE_SINGLE); // Set to start a single-conversion -ads.begin(); +dac.begin(0x60); +dac.setVoltage(2048, false); -// read data -address = ads.ads_i2cAddress; -Wire.beginTransmission(address); -Wire.endTransmission(); -ads.Measure_Differential(); +// 12bit value , false mean not write EEPROM +dac.setVoltage(1024, false);// input digital value "1024" to unit +delay(1000); +dac.setVoltage(2048, false);// input digital value "2048" to unit +delay(1000); ``` ## 回路図 - + ### ピンマッピング - + -
M5Core(GROVEインターフェースA)GPIO22GPIO215VGND
M5Core(GROVE A)GPIO22GPIO215VGND
DAC UnitSCLSDA5VGND
\ No newline at end of file + diff --git a/docs/zh_CN/unit/dac.md b/docs/zh_CN/unit/dac.md index 9f55f462..e2ef7f4d 100644 --- a/docs/zh_CN/unit/dac.md +++ b/docs/zh_CN/unit/dac.md @@ -10,7 +10,7 @@ ## 描述 -**DAC** 是一款集成数字信号转模拟信号芯片的Unit,能够实现输出模拟信号,如电压、声音等,内置的DAC芯片型号是**MCP4725**,并且不带EEPROM。 +**DAC** 是一款集成数字信号转模拟信号芯片的Unit,能够实现输出模拟信号,如电压、声音等,内置的DAC芯片型号是**MCP4725**,并且不带EEPROM。(I2C地址为0x60) ## 特性