This is an alternative way to control which channel is active. is saves only the channels that are active in a vector.

Dependencies:   mbed

Fork of programmingtest by RespiratorySensor Team

Committer:
Jamess
Date:
Sun Feb 28 15:54:13 2016 +0000
Revision:
0:5ab9f1abaf4d
An alternative way to control which channels are active;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jamess 0:5ab9f1abaf4d 1 #include "mbed.h"
Jamess 0:5ab9f1abaf4d 2 #include "Controler.h"
Jamess 0:5ab9f1abaf4d 3 #include "Canal.h"
Jamess 0:5ab9f1abaf4d 4 #include "Communication.h"
Jamess 0:5ab9f1abaf4d 5 #include <vector>
Jamess 0:5ab9f1abaf4d 6
Jamess 0:5ab9f1abaf4d 7 DigitalOut myled(LED1);
Jamess 0:5ab9f1abaf4d 8
Jamess 0:5ab9f1abaf4d 9 Canal ch[30];
Jamess 0:5ab9f1abaf4d 10
Jamess 0:5ab9f1abaf4d 11 Serial pc(USBTX,USBRX);;
Jamess 0:5ab9f1abaf4d 12
Jamess 0:5ab9f1abaf4d 13 int main() {
Jamess 0:5ab9f1abaf4d 14
Jamess 0:5ab9f1abaf4d 15 vector<uint32_t> activeChannel;
Jamess 0:5ab9f1abaf4d 16
Jamess 0:5ab9f1abaf4d 17 while(1){
Jamess 0:5ab9f1abaf4d 18
Jamess 0:5ab9f1abaf4d 19 ch[1].setState(1);
Jamess 0:5ab9f1abaf4d 20 ch[10].setState(1);
Jamess 0:5ab9f1abaf4d 21
Jamess 0:5ab9f1abaf4d 22 activeChannel = checkActivity(ch);
Jamess 0:5ab9f1abaf4d 23
Jamess 0:5ab9f1abaf4d 24 sendActivityState(&pc,activeChannel);
Jamess 0:5ab9f1abaf4d 25
Jamess 0:5ab9f1abaf4d 26
Jamess 0:5ab9f1abaf4d 27 }
Jamess 0:5ab9f1abaf4d 28 }
Jamess 0:5ab9f1abaf4d 29
Jamess 0:5ab9f1abaf4d 30