summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSudhakarKuma2021-06-06 06:41:07 +0530
committerSudhakarKuma2021-06-06 06:41:07 +0530
commitc5c7db9aeb8e4d52a89af0f6eb2fbe12bb5596b1 (patch)
tree6b5f37746a586ff4d3506b31630d7927b096f37c
parent3b2291668aa08d3f10385334ca852d0198813841 (diff)
downloadFLOSS-Arduino-Book-c5c7db9aeb8e4d52a89af0f6eb2fbe12bb5596b1.tar.gz
FLOSS-Arduino-Book-c5c7db9aeb8e4d52a89af0f6eb2fbe12bb5596b1.tar.bz2
FLOSS-Arduino-Book-c5c7db9aeb8e4d52a89af0f6eb2fbe12bb5596b1.zip
Modify the names of the books
-rw-r--r--Microcontroller-programming-with-Arduino-Scilab-and-Xcos.pdf (renamed from scilab-floss-arduino.pdf)bin28771915 -> 28771915 bytes
-rw-r--r--Microcontroller-programming-with-Arduino-and-Julia.pdf (renamed from julia-floss-arduino.pdf)bin24204682 -> 24204682 bytes
-rw-r--r--Microcontroller-programming-with-Arduino-and-OpenModelica.pdf (renamed from openmodelica-floss-arduino.pdf)bin26613087 -> 26613016 bytes
-rw-r--r--Microcontroller-programming-with-Arduino-and-Python.pdf (renamed from python-floss-arduino.pdf)bin24081703 -> 24081703 bytes
-rw-r--r--floss-arduino.fdb_latexmk64
-rw-r--r--floss-arduino.log4
-rw-r--r--floss-arduino.pdfbin31980448 -> 31980454 bytes
-rw-r--r--floss-arduino.tex2
-rw-r--r--tools/openmodelica/linux/Arduino.mo50
-rw-r--r--tools/openmodelica/windows/Arduino.mo24
-rw-r--r--user-code/dcmotor/OpenModelica/dcmotor-loop.mo2
11 files changed, 81 insertions, 65 deletions
diff --git a/scilab-floss-arduino.pdf b/Microcontroller-programming-with-Arduino-Scilab-and-Xcos.pdf
index 9f9f0a1..37835e7 100644
--- a/scilab-floss-arduino.pdf
+++ b/Microcontroller-programming-with-Arduino-Scilab-and-Xcos.pdf
Binary files differ
diff --git a/julia-floss-arduino.pdf b/Microcontroller-programming-with-Arduino-and-Julia.pdf
index 99b5950..dbeb042 100644
--- a/julia-floss-arduino.pdf
+++ b/Microcontroller-programming-with-Arduino-and-Julia.pdf
Binary files differ
diff --git a/openmodelica-floss-arduino.pdf b/Microcontroller-programming-with-Arduino-and-OpenModelica.pdf
index d304850..9dba7a8 100644
--- a/openmodelica-floss-arduino.pdf
+++ b/Microcontroller-programming-with-Arduino-and-OpenModelica.pdf
Binary files differ
diff --git a/python-floss-arduino.pdf b/Microcontroller-programming-with-Arduino-and-Python.pdf
index 9e6a8ea..ec0c1e7 100644
--- a/python-floss-arduino.pdf
+++ b/Microcontroller-programming-with-Arduino-and-Python.pdf
Binary files differ
diff --git a/floss-arduino.fdb_latexmk b/floss-arduino.fdb_latexmk
index 4d3defd..1736627 100644
--- a/floss-arduino.fdb_latexmk
+++ b/floss-arduino.fdb_latexmk
@@ -1,20 +1,20 @@
# Fdb version 3
-["bibtex floss-arduino"] 1622042737 "floss-arduino.aux" "floss-arduino.bbl" "floss-arduino" 1622930729
+["bibtex floss-arduino"] 1622941718 "floss-arduino.aux" "floss-arduino.bbl" "floss-arduino" 1622941754
"/usr/share/texlive/texmf-dist/bibtex/bst/base/unsrt.bst" 1292289607 18030 1376b4b231b50c66211e47e42eda2875 ""
"bibliography.bib" 1620434363 6034 f6dc0004d2871e4ca7419c08dc204c04 ""
- "floss-arduino.aux" 1622930729 182162 f9994066d88244766152947a5fd5a061 "pdflatex"
+ "floss-arduino.aux" 1622941728 182162 f9994066d88244766152947a5fd5a061 "pdflatex"
(generated)
- "floss-arduino.blg"
"floss-arduino.bbl"
-["makeindex floss-arduino.idx"] 1622042727 "floss-arduino.idx" "floss-arduino.ind" "floss-arduino" 1622930729
- "floss-arduino.idx" 1622930729 237 2b0c63ab27d5c1b698757397b5c69953 "pdflatex"
+ "floss-arduino.blg"
+["makeindex floss-arduino.idx"] 1622941706 "floss-arduino.idx" "floss-arduino.ind" "floss-arduino" 1622941754
+ "floss-arduino.idx" 1622941728 237 2b0c63ab27d5c1b698757397b5c69953 "pdflatex"
(generated)
"floss-arduino.ilg"
"floss-arduino.ind"
-["pdflatex"] 1622930720 "/home/fossee/Desktop/floss-scilab-arduino/floss-arduino.tex" "/home/fossee/Desktop/floss-scilab-arduino/floss-arduino.pdf" "floss-arduino" 1622930729
+["pdflatex"] 1622941718 "/home/fossee/Desktop/floss-scilab-arduino/floss-arduino.tex" "/home/fossee/Desktop/floss-scilab-arduino/floss-arduino.pdf" "floss-arduino" 1622941754
"/etc/texmf/web2c/texmf.cnf" 1602253014 475 c0e671620eb5563b2130f56340a5fde8 ""
- "/home/fossee/Desktop/floss-scilab-arduino/floss-arduino.aux" 1622930729 182162 f9994066d88244766152947a5fd5a061 ""
- "/home/fossee/Desktop/floss-scilab-arduino/floss-arduino.tex" 1622042781 7262 cb5d263fde0d042cfddca8c055e43b9b ""
+ "/home/fossee/Desktop/floss-scilab-arduino/floss-arduino.aux" 1622941728 182162 f9994066d88244766152947a5fd5a061 ""
+ "/home/fossee/Desktop/floss-scilab-arduino/floss-arduino.tex" 1622941753 7259 479262da9752d704b19d28b412c8ea30 ""
"/usr/share/texlive/texmf-dist/fonts/enc/dvips/base/8r.enc" 1165713224 4850 80dc9bab7f31fb78a000ccfed0e27cab ""
"/usr/share/texlive/texmf-dist/fonts/map/fontname/texfonts.map" 1577235249 3524 cb3e574dea2d1052e39280babc910dc8 ""
"/usr/share/texlive/texmf-dist/fonts/tfm/jknappen/ec/ecbx0900.tfm" 1136768653 3584 1a7de6c99457381c64abc1a7c545505f ""
@@ -162,19 +162,19 @@
"/usr/share/texmf/web2c/texmf.cnf" 1581979058 38841 ce3692aa899bb693b90b87eaa5d4d84e ""
"/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map" 1604540077 4770781 1ed1abab22da9c3e2cc82e4db562318b ""
"/var/lib/texmf/web2c/pdftex/pdflatex.fmt" 1604540101 8258883 e8330f8aa4fe7c6cdcf08bf0b72237fd ""
- "floss-arduino.OpenModelicad" 1622930729 2789 94b45316c4703c2814892623a4574a72 "pdflatex"
- "floss-arduino.ard" 1622930729 2334 c94555f1ff61e8103bb3261b10e1272b "pdflatex"
- "floss-arduino.aux" 1622930729 182162 f9994066d88244766152947a5fd5a061 "pdflatex"
- "floss-arduino.bbl" 1622042737 3903 02b5ac06a1bbf3155ccc47bfd4f7ca51 "bibtex floss-arduino"
- "floss-arduino.cod" 1622930729 2825 06fb8d275e08fb8e1485763f527f650b "pdflatex"
- "floss-arduino.ind" 1622042727 288 1367e08b6f5cfc1c1a3f8718570f0de1 "makeindex floss-arduino.idx"
- "floss-arduino.juliad" 1622930729 2664 a90d9f2d2055d64a7884dd1a720ecd08 "pdflatex"
- "floss-arduino.lof" 1622930729 16561 6e3ab86ed4fb33f8932bb5080c4a1b38 "pdflatex"
- "floss-arduino.lot" 1622930729 4422 6f5139900d2e4a7028e2cf8a7e17c8fd "pdflatex"
- "floss-arduino.out" 1622930729 16111 5b3e12da3b8f1fd705d7aea671c7b61f "pdflatex"
- "floss-arduino.pyd" 1622930729 2593 f6953c6c110126e07da216023e95df49 "pdflatex"
- "floss-arduino.tex" 1622042781 7262 cb5d263fde0d042cfddca8c055e43b9b ""
- "floss-arduino.toc" 1622930729 21127 4b21fed2df084fa3f257759ac14c93c7 "pdflatex"
+ "floss-arduino.OpenModelicad" 1622941728 2789 94b45316c4703c2814892623a4574a72 "pdflatex"
+ "floss-arduino.ard" 1622941728 2334 c94555f1ff61e8103bb3261b10e1272b "pdflatex"
+ "floss-arduino.aux" 1622941728 182162 f9994066d88244766152947a5fd5a061 "pdflatex"
+ "floss-arduino.bbl" 1622941718 3903 02b5ac06a1bbf3155ccc47bfd4f7ca51 "bibtex floss-arduino"
+ "floss-arduino.cod" 1622941728 2825 06fb8d275e08fb8e1485763f527f650b "pdflatex"
+ "floss-arduino.ind" 1622941706 288 1367e08b6f5cfc1c1a3f8718570f0de1 "makeindex floss-arduino.idx"
+ "floss-arduino.juliad" 1622941728 2664 a90d9f2d2055d64a7884dd1a720ecd08 "pdflatex"
+ "floss-arduino.lof" 1622941728 16561 6e3ab86ed4fb33f8932bb5080c4a1b38 "pdflatex"
+ "floss-arduino.lot" 1622941728 4422 6f5139900d2e4a7028e2cf8a7e17c8fd "pdflatex"
+ "floss-arduino.out" 1622941728 16111 5b3e12da3b8f1fd705d7aea671c7b61f "pdflatex"
+ "floss-arduino.pyd" 1622941728 2593 f6953c6c110126e07da216023e95df49 "pdflatex"
+ "floss-arduino.tex" 1622941753 7259 479262da9752d704b19d28b412c8ea30 ""
+ "floss-arduino.toc" 1622941728 21127 4b21fed2df084fa3f257759ac14c93c7 "pdflatex"
"suppl/acr.tex" 1615963613 1926 fd6481c4666ee0d60331b7d4cc24b645 ""
"suppl/intro.tex" 1621801612 4603 c52cee9f2420b8014f6dce1a41241fa2 ""
"suppl/styles.tex" 1615963613 8143 aa3280f0b59c8631fe8ec44895c9e871 ""
@@ -188,7 +188,7 @@
"tools/shield/shield-V1p2.png" 1618470019 66281 607473e0cfda2ff4b7f6c85d1bbb8ba5 ""
"user-code/dcmotor/OpenModelica/dcmotor-both.mo" 1620088994 1086 a156cd2ac05b581b0e2a0d6daa70642f ""
"user-code/dcmotor/OpenModelica/dcmotor-clock.mo" 1620088994 1002 e95685106fe5e50eba4824e6b0119bd5 ""
- "user-code/dcmotor/OpenModelica/dcmotor-loop.mo" 1622930719 1237 f9d8a01f87a85a0695506b6606ff2f74 ""
+ "user-code/dcmotor/OpenModelica/dcmotor-loop.mo" 1622939243 1237 a8426d0f501ac4c2571d5c9d567948b3 ""
"user-code/dcmotor/arduino/dcmotor-both/dcmotor-both.ino" 1620088994 504 8a85b1257282a49f134cec02b30182e2 ""
"user-code/dcmotor/arduino/dcmotor-clock/dcmotor-clock.ino" 1620088994 426 6316038efc09b67c75c077917c40e3e4 ""
"user-code/dcmotor/arduino/dcmotor-loop/dcmotor-loop.ino" 1620088994 665 a13b061f7e773a0ff7e178ed73915282 ""
@@ -454,19 +454,19 @@
"user-code/thermistor/thermistor-python.tex" 1621730586 6690 dcd0b9c6629922cc2675da1a8eec8d97 ""
"user-code/thermistor/thermistor-scilab.tex" 1621455775 15817 4f8b0a1727ee952a36196e611ce5308c ""
(generated)
- "floss-arduino.lot"
- "floss-arduino.log"
- "floss-arduino.out"
- "floss-arduino.pdf"
- "floss-arduino.lof"
- "floss-arduino.toc"
"floss-arduino.aux"
- "floss-arduino.cod"
- "floss-arduino.OpenModelicad"
- "floss-arduino.thm"
"floss-arduino.ard"
"floss-arduino.pyd"
+ "floss-arduino.pdf"
+ "floss-arduino.OpenModelicad"
+ "floss-arduino.out"
+ "/home/fossee/Desktop/floss-scilab-arduino/floss-arduino.log"
+ "floss-arduino.cod"
"/home/fossee/Desktop/floss-scilab-arduino/floss-arduino.pdf"
+ "floss-arduino.thm"
+ "floss-arduino.toc"
+ "floss-arduino.lof"
"floss-arduino.juliad"
+ "floss-arduino.log"
"floss-arduino.idx"
- "/home/fossee/Desktop/floss-scilab-arduino/floss-arduino.log"
+ "floss-arduino.lot"
diff --git a/floss-arduino.log b/floss-arduino.log
index aa2da03..0d23992 100644
--- a/floss-arduino.log
+++ b/floss-arduino.log
@@ -1,4 +1,4 @@
-This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=pdflatex 2020.11.5) 6 JUN 2021 03:35
+This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=pdflatex 2020.11.5) 6 JUN 2021 06:38
entering extended mode
restricted \write18 enabled.
file:line:error style messages enabled.
@@ -1692,7 +1692,7 @@ Here is how much of TeX's memory you used:
1143 hyphenation exceptions out of 8191
50i,10n,53p,849b,1946s stack positions out of 5000i,500n,10000p,200000b,80000s
{/usr/share/texmf/fonts/enc/dvips/cm-super/cm-super-t1.enc}{/usr/share/texmf/fonts/enc/dvips/cm-super/cm-super-ts1.enc}{/usr/share/texlive/texmf-dist/fonts/enc/dvips/base/8r.enc}</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmex10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr8.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr9.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy6.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy8.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy9.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/bera/fvmr8a.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfbx0900.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfbx1095.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfbx1200.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfbx1440.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfbx2074.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfbx2488.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfrm0600.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfrm0800.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfrm0900.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfrm1000.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfrm1095.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfsi1095.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfss1095.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfti1095.pfb>
-Output written on /home/fossee/Desktop/floss-scilab-arduino/floss-arduino.pdf (284 pages, 31980448 bytes).
+Output written on /home/fossee/Desktop/floss-scilab-arduino/floss-arduino.pdf (284 pages, 31980454 bytes).
PDF statistics:
7845 PDF objects out of 8907 (max. 8388607)
7245 compressed objects within 73 object streams
diff --git a/floss-arduino.pdf b/floss-arduino.pdf
index 02c9cfa..20c27bf 100644
--- a/floss-arduino.pdf
+++ b/floss-arduino.pdf
Binary files differ
diff --git a/floss-arduino.tex b/floss-arduino.tex
index 2b73c2f..6b2bee3 100644
--- a/floss-arduino.tex
+++ b/floss-arduino.tex
@@ -100,7 +100,7 @@
% \let\EntireReport\undefined %% EntireReport is set to false
% If the entire report is not prepared, choose one of scilab, python,
% julia, or OM
-% \newcommand{\Software}{julia}
+% \newcommand{\Software}{OM}
\newcommand{\sscilab}{scilab}
\newcommand{\python}{python}
diff --git a/tools/openmodelica/linux/Arduino.mo b/tools/openmodelica/linux/Arduino.mo
index 5ad25cc..35e8c94 100644
--- a/tools/openmodelica/linux/Arduino.mo
+++ b/tools/openmodelica/linux/Arduino.mo
@@ -508,9 +508,9 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
if ok <> 0 then
strm.print("Check the serial port and try again");
else
+ sComm.delay(1000);
digital_out := sComm.cmd_digital_out(1, 9, 1) "This will turn ON the blue LED";
end if;
- strm.print(String(time));
c_ok := sComm.close_serial(1) "To close the connection safely";
end when;
annotation(
@@ -536,7 +536,6 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
digital_out := sComm.cmd_digital_out(1, 9, 0) "This will turn OFF the blue LED";
sComm.delay(2000) "let the blue LED be off for two seconds";
end if;
- strm.print(String(time));
c_ok := sComm.close_serial(1) "To close the connection safely";
end when;
annotation(
@@ -553,6 +552,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
algorithm
when initial() then
ok := sComm.open_serial(1, 0, 115200) "At port 0 with baudrate of 115200";
+ sComm.delay(2000);
if ok <> 0 then
strm.print("Check the serial port and try again");
else
@@ -564,7 +564,6 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
sComm.delay(3000) "Delay for 3 seconds";
digital_out := sComm.cmd_digital_out(1, 11, 0) "This will turn OFF the red LED";
end if;
- strm.print(String(time));
c_ok := sComm.close_serial(1) "To close the connection safely";
end when;
annotation(
@@ -581,7 +580,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
algorithm
when initial() then
ok := sComm.open_serial(1, 0, 115200) "At port 0 with baudrate of 115200";
- sComm.delay(1000);
+ sComm.delay(2000);
if ok <> 0 then
strm.print("Check the serial port and try again");
else
@@ -592,7 +591,6 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
sComm.delay(1000) "Delay for 1 second";
end for;
end if;
- strm.print(String(time));
c_ok := sComm.close_serial(1) "To close the connection safely";
end when;
annotation(
@@ -614,6 +612,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
algorithm
when initial() then
ok := sComm.open_serial(1, 0, 115200) "At port 0 with baudrate of 115200";
+ sComm.delay(2000);
end when;
if ok <> 0 then
strm.print("Unable to open serial port, please check");
@@ -636,7 +635,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
c_ok := sComm.close_serial(1) "To close the connection safely";
end when;
annotation(
- experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-6, Interval = 0.01));
+ experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-6, Interval = 0.1));
end led_push_button;
model push_button_status "Checking Status of PushButton"
@@ -650,6 +649,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
algorithm
when initial() then
ok := sComm.open_serial(1, 0, 115200) "At port 0 with baudrate of 115200";
+ sComm.delay(2000);
end when;
if ok <> 0 then
strm.print("Unable to open serial port, please check");
@@ -670,7 +670,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
end when;
//sComm.cmd_arduino_meter(digital_in);
annotation(
- experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-6, Interval = 0.01));
+ experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-6, Interval = 0.1));
end push_button_status;
end push;
@@ -700,7 +700,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
else
digital_out := sComm.cmd_digital_out(1, 11, 0) "Turn OFF LED";
end if;
- sComm.delay(200);
+ sComm.delay(500);
end if;
//for i in 1:500 loop
//end for;
@@ -711,7 +711,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
//Run for 500 iterations
//Setting Threshold value of 300
annotation(
- experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-6, Interval = 0.02));
+ experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-6, Interval = 0.2));
end ldr_led;
model ldr_read "Reading light intensity using ldr"
@@ -758,7 +758,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
algorithm
when initial() then
ok := sComm.open_serial(1, 0, 115200) "At port 0 with baudrate of 115200";
- sComm.delay(1000);
+ sComm.delay(2000);
end when;
if ok <> 0 then
strm.print("Unable to open serial port, please check");
@@ -769,11 +769,11 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
digital_out := sComm.cmd_digital_out(1, 11, 1) "Turn ON LED";
sComm.delay(1000);
digital_out := sComm.cmd_digital_out(1, 11, 0) "Turn OFF LED";
- elseif val >= 320 and val <= 900 then
+ elseif val >= 320 and val < 900 then
digital_out := sComm.cmd_digital_out(1, 10, 1) "Turn ON LED";
sComm.delay(1000);
digital_out := sComm.cmd_digital_out(1, 10, 0) "Turn OFF LED";
- elseif val > 900 and val <= 1023 then
+ elseif val >= 900 and val <= 1023 then
digital_out := sComm.cmd_digital_out(1, 9, 1) "Turn ON LED";
sComm.delay(1000);
digital_out := sComm.cmd_digital_out(1, 9, 0) "Turn OFF LED";
@@ -788,7 +788,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
//Threshold 1
//Threshold 2
annotation(
- experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-6, Interval = 0.01));
+ experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-6, Interval = 1));
end pot_threshold;
end pot;
@@ -812,13 +812,13 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
strm.print("Unable to open serial port, please check");
else
val := sComm.cmd_analog_in(1, 4) "read analog pin 4";
- strm.print("Thermistor Readings " + " : " + String(val));
+ strm.print("Thermistor Readings: " + String(val));
if val > 550 then
digital_out := sComm.cmd_digital_out(1, 3, 1) "Turn ON Buzzer";
else
digital_out := sComm.cmd_digital_out(1, 3, 0) "Turn OFF Buzzer";
end if;
- sComm.delay(200);
+ sComm.delay(500);
end if;
digital_out := sComm.cmd_digital_out(1, 3, 0) "Turn OFF Buzzer";
//for i in 1:500 loop
@@ -829,7 +829,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
c_ok := sComm.close_serial(1) "To close the connection safely";
end when;
annotation(
- experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-6, Interval = 0.02));
+ experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-6, Interval = 0.1));
end therm_buzzer;
model therm_read "Thermistor Readings"
@@ -848,7 +848,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
strm.print("Unable to open serial port, please check");
else
val := sComm.cmd_analog_in(1, 4) "read analog pin 4 (thermistor)";
- strm.print("Thermistor Readings " + " : " + String(val));
+ strm.print("Thermistor Readings: " + String(val));
sComm.delay(500);
end if;
//for i in 1:20 loop
@@ -858,7 +858,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
end when;
//Run for 20 iterations
annotation(
- experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-6, Interval = 0.5));
+ experiment(StartTime = 0, StopTime = 20, Tolerance = 1e-6, Interval = 1));
end therm_read;
end thermistor;
@@ -925,19 +925,20 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
algorithm
when initial() then
ok := sComm.open_serial(1, 0, 115200) "COM port is 0 and baud rate is 115200";
+ sComm.delay(2000);
if ok <> 0 then
strm.print("Unable to open serial port, please check");
else
+ sComm.cmd_dcmotor_setup(1, 3, 1, 9, 10) "Setup DC motor of type 3 (L293D), motor 1, pins 9 and 10";
for i in 0:4 loop
- sComm.cmd_dcmotor_setup(1, 3, 1, 9, 10) "Setup DC motor of type 3 (L293D), motor 1, pins 9 and 10";
sComm.cmd_dcmotor_run(1, 1, 100) "Motor 1 runs at PWM 100";
sComm.delay(3000) "for 3 seconds";
sComm.cmd_dcmotor_run(1, 1, 0) "Halt the motor";
sComm.delay(2000) "for 2 seconds";
sComm.cmd_dcmotor_run(1, 1, -100) "Run it at PWM 100 in reverse direction";
sComm.delay(2000) "for 2 seconds";
- sComm.cmd_dcmotor_release(1, 1) "Motor 1 is released";
end for;
+ sComm.cmd_dcmotor_release(1, 1) "Motor 1 is released";
end if;
c_ok := sComm.close_serial(1) "To close the connection safely";
end when;
@@ -949,7 +950,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
package servo
extends Modelica.Icons.ExamplesPackage;
- model servo_init "Rotate Servo Motor by 30 degrees.After the roataion reset it by 0"
+ model servo_init "Rotate Servo Motor by 30 degrees and then reset"
extends Modelica.Icons.Example;
import sComm = Arduino.SerialCommunication.Functions;
import strm = Modelica.Utilities.Streams;
@@ -958,6 +959,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
algorithm
when initial() then
ok := sComm.open_serial(1, 0, 115200) "COM port is 0 and baud rate is 115200";
+ sComm.delay(2000);
if ok <> 0 then
strm.print("Check the serial port and try again");
else
@@ -968,6 +970,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
end if;
c_ok := sComm.close_serial(1) "To close the connection safely";
end when;
+ sComm.cmd_servo_detach(1, 1);
annotation(
experiment(StartTime = 0, StopTime = 5, Tolerance = 1e-6, Interval = 5));
end servo_init;
@@ -982,6 +985,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
algorithm
when initial() then
ok := sComm.open_serial(1, 0, 115200) "COM port is 0 and baud rate is 115200";
+ sComm.delay(2000);
if ok <> 0 then
strm.print("Check the serial port and try again");
else
@@ -1011,6 +1015,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
algorithm
when initial() then
ok := sComm.open_serial(1, 0, 115200) "COM port is 0 and baud rate is 115200";
+ sComm.delay(2000);
if ok <> 0 then
strm.print("Check the serial port and try again");
else
@@ -1019,8 +1024,8 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
sComm.delay(1000) "be there for one second";
sComm.cmd_servo_move(1, 1, 45) "Move the servo to 45 degree";
sComm.delay(1000) "be there for one second";
+ sComm.cmd_servo_detach(1, 1) "Detach the motor";
end if;
- sComm.cmd_servo_detach(1, 1) "Detach the motor";
c_ok := sComm.close_serial(1) "To close the connection safely";
end when;
// sComm.delay(1000);
@@ -1040,6 +1045,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
algorithm
when initial() then
ok := sComm.open_serial(1, 0, 115200) "COM port is 0 and baud rate is 115200";
+ sComm.delay(2000);
if ok <> 0 then
strm.print("Check the serial port and try again");
else
diff --git a/tools/openmodelica/windows/Arduino.mo b/tools/openmodelica/windows/Arduino.mo
index 5f3b92a..2c37c59 100644
--- a/tools/openmodelica/windows/Arduino.mo
+++ b/tools/openmodelica/windows/Arduino.mo
@@ -463,6 +463,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
algorithm
when initial() then
ok := sComm.open_serial(1, 2, 115200) "At port 2 with baudrate of 115200";
+ sComm.delay(2000);
if ok <> 0 then
strm.print("Check the serial port and try again");
else
@@ -493,6 +494,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
digital_out := sComm.cmd_digital_out(1, 9, 1) "This will turn ON the blue LED";
sComm.delay(2000) "let the blue LED be on for two seconds";
digital_out := sComm.cmd_digital_out(1, 9, 0) "This will turn OFF the blue LED";
+ sComm.delay(2000) "let the blue LED be off for two seconds";
end if;
c_ok := sComm.close_serial(1) "To close the connection safely";
end when;
@@ -515,6 +517,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
if ok <> 0 then
strm.print("Check the serial port and try again");
else
+ sComm.delay(2000);
digital_out := sComm.cmd_digital_out(1, 9, 1) "This will turn ON the blue LED";
digital_out := sComm.cmd_digital_out(1, 11, 1) "This will turn ON the red LED";
sComm.delay(5000) "Delay for 5 seconds";
@@ -577,7 +580,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
if ok <> 0 then
strm.print("Unable to open serial port, please check");
else
- val := sComm.cmd_digital_in(1, 12) "";
+ val := sComm.cmd_digital_in(1, 12) "Read from digital pin 12";
if val == 0 then
strm.print("0");
digital_out := sComm.cmd_digital_out(1, 9, 0) "This will turn OFF the blue LED";
@@ -608,6 +611,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
algorithm
when initial() then
ok := sComm.open_serial(1, 2, 115200) "At port 2 with baudrate of 115200";
+ sComm.delay(2000);
end when;
if ok <> 0 then
strm.print("Unable to open serial port, please check");
@@ -710,6 +714,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
algorithm
when initial() then
ok := sComm.open_serial(1, 2, 115200) "At port 2 with baudrate of 115200";
+ sComm.delay(2000);
end when;
if ok <> 0 then
strm.print("Unable to open serial port, please check");
@@ -724,7 +729,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
digital_out := sComm.cmd_digital_out(1, 10, 1) "Turn ON LED";
sComm.delay(1000);
digital_out := sComm.cmd_digital_out(1, 10, 0) "Turn OFF LED";
- elseif val > 900 and val <= 1023 then
+ elseif val >= 900 and val <= 1023 then
digital_out := sComm.cmd_digital_out(1, 9, 1) "Turn ON LED";
sComm.delay(1000);
digital_out := sComm.cmd_digital_out(1, 9, 0) "Turn OFF LED";
@@ -795,7 +800,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
if ok <> 0 then
strm.print("Unable to open serial port, please check");
else
- val := sComm.cmd_analog_in(1, 4) "read analog pin 5 (ldr)";
+ val := sComm.cmd_analog_in(1, 4) "read analog pin 4 (thermistor)";
strm.print("Thermistor Readings: " + String(val));
sComm.delay(500);
end if;
@@ -875,7 +880,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
strm.print("Unable to open serial port, please check");
else
sComm.cmd_dcmotor_setup(1, 3, 1, 9, 10) "Setup DC motor of type 3 (L293D), motor 1, pins 9 and 10";
- for i in 1:4 loop
+ for i in 0:4 loop
sComm.cmd_dcmotor_run(1, 1, 100) "Motor 1 runs at PWM 100";
sComm.delay(3000) "for 3 seconds";
sComm.cmd_dcmotor_run(1, 1, 0) "Halt the motor";
@@ -895,7 +900,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
package servo
extends Modelica.Icons.ExamplesPackage;
- model servo_init "Rotate Servo Motor "
+ model servo_init "Rotate Servo Motor by 30 degrees and then reset"
extends Modelica.Icons.Example;
import sComm = Arduino.SerialCommunication.Functions;
import strm = Modelica.Utilities.Streams;
@@ -904,9 +909,11 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
algorithm
when initial() then
ok := sComm.open_serial(1, 2, 115200) "COM port is 2 and baud rate is 115200";
+ sComm.delay(2000);
if ok <> 0 then
strm.print("Check the serial port and try again");
else
+ sComm.delay(2000);
sComm.cmd_servo_attach(1, 1) "To attach the motor to pin 9 of servo1";
sComm.cmd_servo_move(1, 1, 30) "tell servo to rotate by 30 degrees";
sComm.delay(1000);
@@ -928,9 +935,11 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
algorithm
when initial() then
ok := sComm.open_serial(1, 2, 115200) "COM port is 2 and baud rate is 115200";
+ sComm.delay(2000);
if ok <> 0 then
strm.print("Check the serial port and try again");
else
+ sComm.delay(2000);
sComm.cmd_servo_attach(1, 1) "Attach motor to pin 9. 1 means pin 9.";
sComm.delay(2000);
angle := 20 "Angle by which it has to move";
@@ -982,6 +991,7 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
algorithm
when initial() then
ok := sComm.open_serial(1, 2, 115200) "COM port is 2 and baud rate is 115200";
+ sComm.delay(2000);
if ok <> 0 then
strm.print("Check the serial port and try again");
else
@@ -989,9 +999,9 @@ Arduino.SerialCommunication.Functions.<b>ieeesingle2num</b>(hexa);
sComm.delay(2000);
for i in 1:50 loop
val := sComm.cmd_analog_in(1, 2) "Read potentiometer value";
- val := integer(val * 180 / 1023);
+ val := integer(val * 180 / 1023) "Scale Potentiometer value to 0-180";
sComm.cmd_servo_move(1, 1, val) "Command the servo motor";
- sComm.delay(500) "sleep for 1000 milliseconds";
+ sComm.delay(500) "sleep for 500 milliseconds";
end for;
sComm.cmd_servo_detach(1, 1) "Detach the motor";
end if;
diff --git a/user-code/dcmotor/OpenModelica/dcmotor-loop.mo b/user-code/dcmotor/OpenModelica/dcmotor-loop.mo
index 8bccf2d..6c643c4 100644
--- a/user-code/dcmotor/OpenModelica/dcmotor-loop.mo
+++ b/user-code/dcmotor/OpenModelica/dcmotor-loop.mo
@@ -12,7 +12,7 @@ algorithm
strm.print("Unable to open serial port, please check");
else
sComm.cmd_dcmotor_setup(1, 3, 1, 9, 10) "Setup DC motor of type 3 (L293D), motor 1, pins 9 and 10";
- for i in 0:4 loop
+ for i in 1:4 loop
sComm.cmd_dcmotor_run(1, 1, 100) "Motor 1 runs at PWM 100";
sComm.delay(3000) "for 3 seconds";
sComm.cmd_dcmotor_run(1, 1, 0) "Halt the motor";