You are here

Custom code changes- I/O pin go high or low

3 posts / 0 new
Last post
dsuresh
Offline
Last seen: 11 months 3 days ago
VESC Free
Joined: 2021-02-10 18:57
Posts: 42
Custom code changes- I/O pin go high or low

Hi,
Can I set a pin to go high under a certain condition for example: when the battery is lower than a certain value, can I make one of the pins to go high or low? and if so how can I make that happen?

vadicus
Offline
Last seen: 1 day 5 hours ago
VESC Free
Joined: 2018-08-17 07:26
Posts: 427

You could have checked the vesc code and found examples or read ChibiOS but that's one way to do it:           

 if (condition)  {
                                palSetPad(GPIOx, x); or

                               palClearPad(GPIOx, x);

}

 

 

 

NextGen FOC High voltage 144v/34s, 30kw (https://vesc-project.com/node/1477)

dsuresh
Offline
Last seen: 11 months 3 days ago
VESC Free
Joined: 2021-02-10 18:57
Posts: 42

Hi Vadicus,

 

I am thinking of using the RX pin out and I checked it on the Sch it shows as GPIOB 11. 

So if does the following makes sense?

 if (condition)  {
                                palSetPad(GPIOB_Pin 15, 15)

} ?

Dave