Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 8 Interrupt code and serialScope do not match together #37

Open
Seikilos opened this issue Dec 29, 2018 · 2 comments
Open

Chapter 8 Interrupt code and serialScope do not match together #37

Seikilos opened this issue Dec 29, 2018 · 2 comments

Comments

@Seikilos
Copy link

Seikilos commented Dec 29, 2018

There is something odd in the setup.
The serial scope under https://github.com/hexagon5un/AVR-Programming/blob/master/Chapter08_Hardware-Interrupts/capSense/serialScope.py
does only handle USART data in terms of reading it as ord (https://github.com/hexagon5un/AVR-Programming/blob/master/Chapter08_Hardware-Interrupts/capSense/serialScope.py#L6)

But the entire capSense code at trunk does not work well with that. It sends string data and newlines to the serial scope making no sense. See here and here.
The capSense line

printString("==[ Cap Sensor ]==\r\n\r\n");

and others cannot be interpreted properly by the mentioned serial scope python script.


(Bonus brag :) )
I also spent about two days trying to get this working without success because I am using Atmel Studio with my custom defined header and project files (not the Makefiles), where I've defined #define F_CPU 1000000UL // 1 MHz
Since this chapter delays the explanation of the line clock_prescale_set(clock_div_1); /* full speed */ and does not even briefly mention that F_CPU must be adjusted here I would somewhere drop a hint for newbies like me.

@rodolfoacostacastro
Copy link

I agree here. I think something changed when they updated the program to python3...5 years ago. I have the same issue: capSense.c is sending strings and chars, but serialScope.py is reading just bytes. I don't know how to solve it, because I'm ignorant in python. I can read the right values using the Serial Monitor in the Arduino IDE as an Arduino Uno board, because there the serial monitor is expecting strings. So I kind of solve the problem, but it would be nice to adjust serialScope.py :) I´m enjoying the book a lot!

@rodolfoacostacastro
Copy link

Now I'm getting the right values :))
Changing this functions on serialScope.py will do the trick for the capacity sensor in chapter 8:

def readValue(serialPort):
return(serialPort.readline().decode('utf-8').strip())

def plotValue(value):
print(value)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants