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.
Dependencies: mbed
Fork of Nucleo_PS3_Jikken_2 by
Diff: main.cpp
- Revision:
- 12:6445a3c3d34c
- Parent:
- 11:1ca2498815c9
- Child:
- 13:5bccc2d600eb
--- a/main.cpp Sat Sep 19 02:11:33 2015 +0000
+++ b/main.cpp Fri Oct 02 09:53:20 2015 +0000
@@ -194,6 +194,13 @@
return input;
}
+void setFCLED(double RED,double GREEN,double BLUE)
+{
+ Red=RED;
+ Green=GREEN;
+ Blue=BLUE;
+}
+
int main() {
pc.baud(230400);
Dev.baud(921600);
@@ -201,19 +208,17 @@
DigitalIn bt(USER_BUTTON);
Dev.attach(num,Serial::RxIrq);//受信割り込み設定
Green=0;Blue=0;Red=0;
+ double gValue=0,bValue=0,rValue=0;
DigitalOut l(PB_2);
int sqf=0;
double deg;
int val;
i2c.frequency(400000);
- Blue=0.8f;Green=0;
- kGreen=0.8f;
+ setFCLED(0,0.8,0.8);
bool obonFlag=false,pLeftF=false,pRightF=false,btCrF=false;
while(true)
- {
- Blue=0.8f;Green=0;Red=0;
-
+ {
//ポール検出モード
if(getBt(btTri)&&getBt(btSph)){
detectPole();
@@ -239,7 +244,8 @@
//射出
if(getBt(btTri)&&obonFlag){
kRed=shotToDenziben(0x02,15,1,airAddr);
- wait(0.1f);
+ wait(0.2f);
+ kRed=shotToDenziben(0x02,0,1,airAddr);
kRed=0;
}
@@ -278,19 +284,25 @@
sqf=1;
//タッチセンサ
- if(((int)DATA[1]&12)==12)
- Blue=0.0f;Green=0.8f;Red=0;
+ if(((int)DATA[1]&12)==12){
+ bValue=0.0f;gValue=0.8f;rValue=0;
+ }
+ else{
+ bValue=0.8f;gValue=0;rValue=0;
+ }
//お盆回し
if(getPress(presUp)){
kRed=shotToDenziben(0x02,7,1,airAddr);
wait(0.1);
obonFlag=true;
+ rValue=0.8;gValue=0;bValue=0.8;
kRed=0;
}
else if(getPress(presDown)){
kRed=shotToDenziben(0x02,0,1,airAddr);
wait(0.1);
+ bValue=0.8f;gValue=0;rValue=0;
obonFlag=false;
kRed=0;
}
@@ -304,6 +316,7 @@
else
stopCounter++;
Mechanum.putc(val);
+ setFCLED(rValue,gValue,bValue);
wait(0.03f);
do{
if(!debugFlag)
