1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #define BOARD Versa1
- #include <fruit.h>
- unsigned char period = 200;
- unsigned char t = 0, t2 = 0;
- t_delay mainDelay;
- void setup(void) {
- fruitInit();
-
- pinModeDigitalOut(LED);
- digitalClear(LED);
- delayStart(mainDelay, 5000);
-
- pinModeDigitalIn(K1);
- }
- void loop() {
- fraiseService();
- if(delayFinished(mainDelay))
- {
- delayStart(mainDelay, 5000);
- t = t + 1;
- if(t >= period){
- t = 0;
- t2 = t2 + 1;
- printf("CHello! t2= %d K1= %d\n", t2, digitalRead(K1));
- }
- }
- }
- void fraiseReceiveChar()
- {
- unsigned char c;
-
- c=fraiseGetChar();
- if(c=='L'){
- c=fraiseGetChar();
- digitalWrite(LED, c!='0');
- }
- else if(c=='E') {
- printf("C");
- c = fraiseGetLen();
- while(c--) printf("%c",fraiseGetChar());
- putchar('\n');
- }
- }
- void fraiseReceive()
- {
- unsigned char c;
-
- c=fraiseGetChar();
- switch(c) {
- PARAM_CHAR(1,period); break;
-
- }
- }
|