@@ -53,15 +53,15 @@ void printStatus(uint8_t status);
5353void flipProfile ();
5454
5555void setup () {
56+ Serial.begin (BAUD_RATE);
57+ Serial.println (" Running" );
5658 Serial1.begin (BAUD_RATE);
5759 ant.setSerial (Serial1);
5860 // Delay after initial setup to wait for user to connect on serial
5961
6062 router.setDriver (&ant); // never touch ant again
6163 router.setAntPlusNetworkKey (NETWORK_KEY);
6264
63- Serial.begin (BAUD_RATE);
64- Serial.println (" Running" );
6565 bikeSpeed.onDataPage (bicycleSpeedBaseDataPageHandler);
6666 bikeSpeed.onBicycleSpeedBatteryStatus (batteryStatusDataPageHandler);
6767 bikeSpeed.onBicycleSpeedMotionAndSpeed (motionAndSpeedDataPageHandler);
@@ -90,6 +90,8 @@ void loop() {
9090}
9191
9292void flipProfile () {
93+ uint8_t status;
94+ Serial.println (" ===========================" );
9395 if (isHrProfileRunning) {
9496 // stop will be called by remove profile as well if you forget
9597 hr.stop ();
@@ -99,8 +101,7 @@ void flipProfile() {
99101 Serial.print (" Profile added to channel: " );
100102 Serial.println (CHANNEL_0);
101103 bikeSpeed.begin ();
102- uint8_t status = bikeSpeed.waitForPair ();
103- printStatus (status);
104+ status = bikeSpeed.waitForPair ();
104105 } else {
105106 bikeSpeed.stop ();
106107 // remove by channel index
@@ -109,9 +110,9 @@ void flipProfile() {
109110 Serial.print (" Profile added to channel: " );
110111 Serial.println (channel);
111112 hr.begin ();
112- uint8_t status = hr.waitForPair ();
113- printStatus (status);
113+ status = hr.waitForPair ();
114114 }
115+ printStatus (status);
115116 isHrProfileRunning = !isHrProfileRunning;
116117}
117118
0 commit comments