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.
main.cpp
- Committer:
- johnnyken
- Date:
- 2018-01-15
- Revision:
- 4:e31648a823e2
- Parent:
- 3:d4caf19048aa
File content as of revision 4:e31648a823e2:
//ロボコン3年投擲テスト用プログラム //pin番号は古い基盤の //hファイル #include "mbed.h" #include "QEI.h" //difine //pin設定 DigitalOut valve1(p21); QEI rollen(p29, p30, NC, 1024); DigitalOut led1(LED1); DigitalOut led2(LED2); DigitalOut led3(LED3); DigitalOut led4(LED4); Serial pc(USBTX,USBRX); //timer初期化 Ticker rollening; //グローバル変数 int enc = 0; int enc_old = 0; //過去カウント比較用 //グローバル関数 void Dthrow(){ //led2=!led2; enc=rollen.getPulses(); pc.printf("%d\n",enc); if(enc > 0){ led2 = 1; valve1 = 1; } else{ led2 = 0; valve1 = 0; } if(enc>enc_old){ led1 = 1; led3 = 0; } else{ led1 = 0; led3 = 1; } } //main関数 int main(){ //led2=1; rollening.attach(&Dthrow, 0.01); //メモ:attaach_usでマイクロ秒もいけるらしいですがいけませんでした while(1){ } }