hi, I have a big problem with input pin and output pin, when I put this code all work, I push switch and the led is turn off and when I dont push switch the led is turn on, this is the code.
#include "sys/axon.h"
#include "C:\WebbotLib\iopin.h"
void appInitHardware(void){
pin_make_output(C0,FALSE);
pin_make_input(A0,FALSE);
}
TICK_COUNT appInitSoftware(TICK_COUNT loopStart){
return 0;
}
TICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart) {
if(pin_is_high(A0)){
pin_low(C0);
}else{
pin_high(C0);
}
return 1;
}
the problem become when you change the pin_low(C0); in the "else" and the pin_high(C0); in the "if", when the program get started there are a problem, because the program get started the led turn on(when the led must turn off), and when I push the switch the led shine to much(a lot) and when I dont push switch the led return to the original shine(less shine), this is the code, when that happen.
if(pin_is_high(A0)){
pin_high(C0);
}else{
pin_low(C0);
}