Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 1:3e1c05f8d7e8, committed 2020-10-20
- Comitter:
- Tetsuki
- Date:
- Tue Oct 20 09:05:02 2020 +0000
- Parent:
- 0:26508adf6f76
- Commit message:
- meaning of each color, commenting out the reset
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Oct 09 09:07:35 2020 +0000
+++ b/main.cpp Tue Oct 20 09:05:02 2020 +0000
@@ -8,6 +8,11 @@
p14~p17で電圧、周波数を10V/Hzずつ変更するようにした。
電圧周波数の初期値は570V/100Hz
+黄色:電圧10V上昇
+青色:電圧10V下降
+白色:周波数10Hz上昇
+黒色:周波数10Hz下降
+
2ボタン同時押しでリセットされるようにしたがうまく動作しなかったためその部分は変更が必要。
***************************/
@@ -18,8 +23,8 @@
AnalogOut signal(p18);//AnalogOutピン(1768は18番ピン)
Timer timer;//カウンタ
Timer chtimer;//チャタリング用タイマー
-int Freq = 100;//正弦波の周波数
-int Volt = 570;//印加電圧値
+int Freq;//正弦波の周波数
+int Volt;//印加電圧値
//スイッチ用ピンの宣言
DigitalIn VoltUp(p14);
@@ -43,6 +48,8 @@
int timediff = 0;
timer.start();
chtimer.start();
+ Volt = 570;
+ Freq = 100;
while(1) {
if(VoltUp.read() == 1){//黄押すと電圧10V増加
timediff = chtimer.read_ms();
@@ -59,7 +66,7 @@
led4 = 0;
wait(0.5);
}
- if(VoltDown.read() == 1){//青押すと周波数10Hz減少
+ if(VoltDown.read() == 1){//青押すと電圧10V減少
timediff = chtimer.read_ms();
if(timediff > MIN_TIME_DIFF) {
Volt = Volt - 10;
@@ -101,7 +108,7 @@
led4 = 1;
wait(0.5);
}
- if(VoltUp.read() == 1 && VoltDown.read() == 1){//黄,青同時押しで電圧を570Vにリセット
+ /*if(VoltUp.read() == 1 && VoltDown.read() == 1){//黄,青同時押しで電圧を570Vにリセット
timediff = chtimer.read_ms();
if(timediff > MIN_TIME_DIFF) {
Volt = 570;
@@ -124,7 +131,7 @@
led3 = 1;
led4 = 1;
wait(0.5);
- }
+ }*/
//sin波の出力※0~1の値をp18に送るため570で割る
t = (double)timer.read_us() * 0.000001;
signal = ((0.5 + sin(2.0 * 3.1415926 * Freq * t)/2) * Volt) / 570;