STM32F103C8 attachinterrupt

Any other STM32 based boards
vib
Posts: 3
Joined: Wed May 03, 2017 7:35 pm

STM32F103C8 attachinterrupt

Postby vib » Wed May 03, 2017 7:44 pm

Hi everyone,
This is my first post and I'm really new to STM32 chip. I spent few hours and developed few projects on arduino but I want to switch on STM32.
I have to admit this is not an easy move for me.

here is my problem:
I made a digital scale for a specific purpose and used HX711 library.
Sometime, I need to set tare the scale (sorry if my english is not really good) so i use scale.tare(); function.
To enable this function I put a push button. I tried to kept it simple: button is wired to PB0 from on side and ground the other side.
I tried something with debounce but it was not working for me and as a final solution, I tried an attachinterrupt because I really like the way it works.
Unfortunatelly, when I lunch my sketch with this attachinterrupt code, this is like my push button is always pressed and I don't know why.
Any idea?

Code (only the attachinterrupt part):
attachInterrupt(PB0, scaletare, RISING); // I tried Rising, change, same result
void scaletare()
{
scale.tare();
Serial.println("tare !");
}

and push buton wiring/ + on PB0 and - to gnd

Thank you for your help

vib
Posts: 3
Joined: Wed May 03, 2017 7:35 pm

Re: STM32F103C8 attachinterrupt

Postby vib » Wed May 03, 2017 8:26 pm

Here is the answer: I had to much noise with the wiring like this.
I just add the pinmode as inputpullup and everything is fine ;)

User avatar
zoomx
Posts: 380
Joined: Mon Apr 27, 2015 2:28 pm
Location: Mt.Etna, Italy

Re: STM32F103C8 attachinterrupt

Postby zoomx » Fri May 05, 2017 7:55 am

Putting a Serial.Print into the interrupt routine is not a good idea but it seems that it works.....

vib
Posts: 3
Joined: Wed May 03, 2017 7:35 pm

Re: STM32F103C8 attachinterrupt

Postby vib » Wed May 10, 2017 11:48 am

Thank you for your input, this is only for debug ;9
This is removed in the final sketch


Return to “All other boards”

Who is online

Users browsing this forum: No registered users and 1 guest