summaryrefslogtreecommitdiff
path: root/csc-new.html
blob: 0874aa3b180d346e35abbf1773ab4e2a51a174a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<!DOCTYPE html>
<head>
<title>Control Systems Club Web Controlled Servo Instructions</title>
<meta charset="utf-8"/>
<link rel="stylesheet" href="https://hairydiode.xyz/style.css"/>
<link rel="icon" type="image/png" href="https://hairydiode.xyz/img/fav/logo.png"/>
</head>
<body>
<div class="content">
<pre>
<!--
123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890
一二三四
-->--------------------------------------------------------------------------------

<a href="https://hairydiode.xyz">>HairyDiode</a>                                             

--------------------------------------------------------------------------------
<!--
123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890
一二三四-->Control Systems Club Web Controlled Servo Instructions                 1-24-2019
--------------------------------------------------------------------------------

Ok everyone, we'r going to start a web controlled servo project.

What we want, is a webpage where you click "move servo" and a servo moves.

It will work like this, with 4 components we have to write:

The Front End
The Backend
The Servo Controller
The Arduino Firmware

+---Digital Ocean VPS--+                    +--Control Computer--+
|HTML/CSS/JS Front End |   HTTPS POST       |C Servo Controller  |
|Golang Backend        |====================|                    |
+----------------------+                    +--------------------+
         ||                                          ||
         ||H                                         ||U
         ||T                                         ||S
         ||T                                         ||B
         ||P                                         ||
         ||S                                         ||S
         ||                                          ||e
 +-Client Computer-+                                 ||r
 |  Some sort of   |                                 ||i
 |  Browser        |                                 ||a
 |                 |                                 ||l
 |                 |                                 ||
 |                 |                        +----------------------+
 +-----------------+                        |C/C++ Arduino Firmware|
                                            |                      |
                                            +----------------------+
                                                     ||
                                                     ||S
                                                     ||e
                                                     ||r
                                                     ||v
                                                     ||o
                                                     ||
                                                     ||W
                                                     ||i
                                                     ||r
                                                     ||e
                                                     ||
                                                 +-Servo-+           
                                                 |       |    
                                                 +-------+     

The Frontend will consist of html templates, as well as supporting css and js
files, that will implement a simple UI that allows the user to click on a button
that sends a POST request to the backend to move the servo.
<a href="https://www.w3schools.com/html/html_forms.asp">W3 Forms Tutorial</a>
<a href="https://www.w3schools.com/html/html_css.asp">Inline CSS Tutorial</a>
<a href="https://www.w3schools.com/cssref/pr_class_display.asp">CSS Display Property Tutorial</a>

The Backend will be a Golang executable that will be listening for HTTPS
connections, and serves the frontend, as well as listen for POST requests from
both the Frontend and the Control Computer. A POST request from the frontend
updates the desired state of the servo, and a POST request from the Control
Computer will update the actual state. Both the Actual state and the desired
state should also be served as well.
<a href="https://golang.org/doc/articles/wiki/">Go net/http and html/template Libraries Tutorial</a>

The Servo Controller will poll the Backend for the desired state, communicate
this to the Arduinoi via the RS-232 Library, and return this desired state via
POST to the backend so as to update the actual state.
<a href="https://www.teuniz.net/RS-232/">RS-232 Library</a>
<a href="https://hairydiode.xyz/cgit/ROBOARM.git/tree/">RS-232 Example</a>
<a href="https://curl.haxx.se/libcurl/c/">cURL API</a>
<a href-"https://curl.haxx.se/libcurl/c/example.html">cURL Code Examples</a>

The Arduino Firmware will commands over the USB Serial Wire, and output that to
the servo.
<a href="https://www.arduino.cc/en/tutorial/SoftwareSerialExample">Arduino Serial Tutorial</a>
<a href="https://www.arduino.cc/en/Tutorial/Knob">Arduino Servo Tutorial</a>


</pre>
</div>
<br>
<br>
</body>
<!-- 
if you're digging in the src you might be interested in how this site works
here: https://hairydiode.xyz/meta2 
-->