Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Course on Internet of Things Exercises Session 1: | ||||||||
Line: 47 to 47 | ||||||||
| ||||||||
Added: | ||||||||
> > |
| |||||||
Try also several spaces in between operands and operator.
Exercise 3: Conditions | ||||||||
Changed: | ||||||||
< < | Like in exercise2, start with 2 numbers a,b with values 5 and 3. In your program check which of the 2 numbers is bigger and print the result. | |||||||
> > | Like in exercise2, start with 2 numbers a,b with values 5 and 7. In your program check which of the 2 numbers is bigger and print the result. | |||||||
Then improve the program asking the user for 2 integer numbers. Make sure he enters 2 correct numbers and capture possible errors. This is a typical output: | ||||||||
Line: 65 to 66 | ||||||||
| ||||||||
Changed: | ||||||||
< < | Exercise 5: Some maths: Calculate the sine function | |||||||
> > | Exercise 5: A bit of Mathematics: Calculate the sine function | |||||||
Write a script that asks the user for an angle in degrees. Calculate the sine of this angle.
Exercise 6: Classes | ||||||||
Line: 81 to 82 | ||||||||
| ||||||||
Changed: | ||||||||
< < | When running on a PC you may want to plot the series as well. | |||||||
> > | In order to make this exercise run on the ESP32 you must first upload your mathSeries.py module implementing the MathSeries class into the file system of the ESP32. Create a directory called lib on the ESP32 file system and put your module there:
ampy mkdir /lib
ampy put mathSeries.py /lib/mathSeries.py
Once this is done, go to the REPL window of thonny and
import mathSeries
You can now create an instance of the MathSeries class:
series = mathSeries.MathSeries()
When running on a PC you may want to plot the series as well. If you don't know how to plot data in Python, you will find all the information needed here: https://matplotlib.org/3.2.1/index.html | |||||||
-- Uli Raich - 2020-05-03 |