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.
Diff: main.cpp
- Revision:
- 14:7cc41420a12c
- Parent:
- 13:0f385bfe3e0d
- Child:
- 15:4604a7ee9c77
diff -r 0f385bfe3e0d -r 7cc41420a12c main.cpp
--- a/main.cpp Fri May 04 18:52:34 2018 +0000
+++ b/main.cpp Fri May 04 21:00:25 2018 +0000
@@ -6,29 +6,31 @@
// MACHINE SETUP ---------------------------------------------------------------------------
// drivers output signal
-DigitalOut stepX(D2);
+DigitalOut enable(D2);
+
DigitalOut dirX(D3);
+DigitalOut stepX(D5);
-DigitalOut stepY(D8);
-DigitalOut dirY(D9);
+DigitalOut dirY(D6);
+DigitalOut stepY(D7);
-DigitalOut stepZ(D11);
-DigitalOut dirZ(D12);
+DigitalOut dirZ(D8);
+DigitalOut stepZ(D9);
// hardware input signal
// end-of-stroke sensors
-InterruptIn endX1(D14);
-InterruptIn endX2(D10);
+InterruptIn endX1(D10);
+InterruptIn endX2(D11);
-InterruptIn endY1(D5);
+InterruptIn endY1(D12);
InterruptIn endY2(D13);
// IHM for development
AnalogIn joyX(A0);
AnalogIn joyY(A1);
-DigitalIn zUp(D7);
-DigitalIn zDwn(D6);
+DigitalIn zUp(D14);
+DigitalIn zDwn(D15);
// variables definition
int modeStatus = 0;
@@ -102,6 +104,8 @@
int main(){
printf("Starting...\r\n");
+
+ enable = 0;
endX1.fall(&endX1Int_press);
endX1.rise(&endX1Int_release);
@@ -124,15 +128,15 @@
valZDwn = zDwn;
if(valX > 0.7){
- if(x_dir != x_minus){
- x_dir = x_minus;
+ if(x_dir != x_plus){
+ x_dir = x_plus;
}
activeX = 1;
totalX-=1;
}
else if(valX < 0.3){
- if(x_dir != x_plus){
- x_dir = x_plus;
+ if(x_dir != x_minus){
+ x_dir = x_minus;
}
activeX = 1;
totalX+=1;