|
META TOPICPARENT |
name="WebHome" |
Solutions to the exercises |
|
-
- convert the pin number from string to integer. You may be tempted to use atoi() but you must not, because atoi() does not check for conversion errors. Use strtol() instead.
- Make sure the converted pin number is in the range 0..7
For the "read" case we are done with our checks here
- for the "write" case convert the logic level and make sure you get either 0 or 1
|
|
> > | https://iotworkshop.africa/pub/Embedded_Systems/SolutionsToTheExercises/leds.tar.gz
|
|
- Solutions to the exercises on files, pipes and sockets
These exercises have been skipped but I attach the solution codes nevertheless such that you can have a look at them and/or use them in a future course
https://iotworkshop.africa/pub/Embedded_Systems/SolutionsToTheExercises/communication.tar.gz
|
|
< < |
- Solutions to exercise 5: The DHT11 temperature and humidity sensor
The code contains an example of how to write a shared library. You can collect all libraries for your course in a common directory (.g. /opt/ucc/lib) as you do for all corresponding include files (/opt/ucc/include). Then you make the directory of libraries globally known to the system by putting a file ucc.conf into /etc/ld.so.conf. ucc.conf simply contains the text /opt/ucc/lib. Finally you run the command sudo ldconf and /opt/ucc/lib will be added to the search path of shared libraries on the system
|
> > |
- Solutions to exercise 5: The DHT11 temperature and humidity sensor
The code contains an example of how to write a shared library. You can collect all libraries for your course in a common directory (.g. /opt/ucc/lib) as you do for all corresponding include files (/opt/ucc/include). Then you make the directory of libraries globally known to the system by putting a file ucc.conf into /etc/ld.so.conf. ucc.conf simply contains the text /opt/ucc/lib. Finally you run the command sudo ldconf and /opt/ucc/lib will be added to the search path of shared libraries on the system.
- Solutions to exercise 6: Stepping Motors
In addition to the solutions to the stepping motor exercises I add the code written for the rotary encoder, which is a sort of a reverse stepping motor. Instead of sending a pulse sequence, you receive one and by interpreting it you can tell the relative angle the motor has reached. Here is the code:
https://iotworkshop.africa/pub/Embedded_Systems/SolutionsToTheExercises/rotaryEncoder.tar.gz
|
|
-- Uli Raich - 2017-10-14 |
|
META FILEATTACHMENT |
attachment="solEx2.tar.gz" attr="" comment="" date="1507985585" name="solEx2.tar.gz" path="solEx2.tar.gz" size="818105" user="uli" version="1" |
META FILEATTACHMENT |
attachment="makeExamples.tar.gz" attr="" comment="" date="1507985978" name="makeExamples.tar.gz" path="makeExamples.tar.gz" size="1714" user="uli" version="1" |
META FILEATTACHMENT |
attachment="communication.tar.gz" attr="" comment="" date="1509006291" name="communication.tar.gz" path="communication.tar.gz" size="128" user="uli" version="1" |
|
|
< < |
META FILEATTACHMENT |
attachment="rotaryEncoder.tar.gz" attr="" comment="" date="1509010595" name="rotaryEncoder.tar.gz" path="rotaryEncoder.tar.gz" size="6231" user="uli" version="1" |
|
> > |
META FILEATTACHMENT |
attachment="rotaryEncoder.tar.gz" attr="" comment="" date="1509018835" name="rotaryEncoder.tar.gz" path="rotaryEncoder.tar.gz" size="6231" user="uli" version="1" |
META FILEATTACHMENT |
attachment="leds.tar.gz" attr="" comment="" date="1509018644" name="leds.tar.gz" path="leds.tar.gz" size="6410" user="uli" version="1" |
|