I was developing small embedded system over arduino, and it was counting events using interrupts. The code was like that:
volatile float count= 0;
attachInterrupt(0, increaseCount, CHANGE);
void increaseCount(){
++count;
}
the count variable should be volatile to access it inside an interrupt. Now, I am writing it over Raspberry pi using python. But, python has nothing called volatile. So, is there another technique to increase variable during thread/event. python give me that error when the event happens and the variable increases.
File "MyApp.py", line 5, in my_callback
count += 1
UnboundedLocalError: local variable 'count' referenced before assignment
Any help ??