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:
- 3:8790e69f8c59
- Parent:
- 2:32d2cd7d744b
--- a/main.cpp Thu Jan 23 09:16:38 2020 +0000
+++ b/main.cpp Fri Jan 24 11:26:29 2020 +0000
@@ -2,49 +2,46 @@
#include "Motor.h"
#include "MCP.h"
#include "XBee.h"
+#include <stdint.h>
#define SDA PB_7
#define SCL PB_6
#define MCP_ADDRESS 0x40
-using namespace MOTOR
-
MCP MCP(SDA, SCL, MCP_ADDRESS);
-
-Serial pc(USBTX, USBRX);
-
XBEE::ControllerData *controller;
MOTOR::MotorStatus motor[MOUNTING_MOTOR_NUM];
+/* ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ */
+
+
+
+/* ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
+
int main() {
- __enable_irq();
-
+ XBEE::Controller::Initialize();
MOTOR::Motor::Initialize();
- MCP.PinMode(7, INPUT_PULLUP);
- MCP.PinMode(6, OUTPUT);
+ __enable_irq();
+
+ /* ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ */
+
+ /* ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
+
while(1) {
+
controller = XBEE::Controller::GetData();
-
MCP.Update();
- int a;
+ /* ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ */
+
- /* write ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ */
- for(int i = 0; i < 16; i++) {
- a = MCP.Read(i);
- pc.printf("%d",a);
- }
- pc.printf("\n\r");
- int b = MCP.Read(7);
+ /* ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
- MCP.Write(6, b);
-
- //
MOTOR::Motor::Update(motor);
}
}