1
1
# SPDX-FileCopyrightText: 2022 Liz Clark for Adafruit Industries
2
2
#
3
3
# SPDX-License-Identifier: MIT
4
- # Pico W CircuitPython HTTP Server
5
4
6
5
import os
7
6
import time
@@ -90,7 +89,6 @@ def c_to_f(temp):
90
89
unit = "F"
91
90
# font for HTML
92
91
font_family = "monospace"
93
- party_state = "Party?"
94
92
95
93
# the HTML script
96
94
# setup as an f string
@@ -107,30 +105,32 @@ def webpage():
107
105
<style>
108
106
html{{font-family: { font_family } ; background-color: lightgrey;
109
107
display:inline-block; margin: 0px auto; text-align: center;}}
110
- h1{{color: deeppink; padding: 2vh; font-size: 35px;}}
111
- p{{font-size: 1.5rem;}}
108
+ h1{{color: deeppink; width: 200; word-wrap: break-word; padding: 2vh; font-size: 35px;}}
109
+ p{{font-size: 1.5rem; width: 200; word-wrap: break-word; }}
112
110
.button{{font-family: { font_family } ;display: inline-block;
113
111
background-color: black; border: none;
114
112
border-radius: 4px; color: white; padding: 16px 40px;
115
113
text-decoration: none; font-size: 30px; margin: 2px; cursor: pointer;}}
116
- p.dotted {{margin: auto; height: 50px;
114
+ p.dotted {{margin: auto;
117
115
width: 75%; font-size: 25px; text-align: center;}}
118
116
</style>
119
117
</head>
120
118
<body>
121
119
<title>Pico W HTTP Server</title>
122
120
<h1>Pico W HTTP Server</h1>
121
+ <br>
123
122
<p class="dotted">This is a Pico W running an HTTP server with CircuitPython.</p>
124
- <p class="dotted">The current ambient temperature near the Pico W is
125
- <span style="color: deeppink;">{ temp_test } °{ unit } </span></p>
126
- <h1>Control the LED on the Pico W with these buttons:</h1>
123
+ <br>
124
+ <p class="dotted">The current ambient temperature near the Pico W is
125
+ <span style="color: deeppink;">{ temp_test } °{ unit } </span></p><br>
126
+ <h1>Control the LED on the Pico W with these buttons:</h1><br>
127
127
<form accept-charset="utf-8" method="POST">
128
128
<button class="button" name="LED ON" value="ON" type="submit">LED ON</button></a></p></form>
129
129
<p><form accept-charset="utf-8" method="POST">
130
130
<button class="button" name="LED OFF" value="OFF" type="submit">LED OFF</button></a></p></form>
131
131
<h1>Party?</h>
132
132
<p><form accept-charset="utf-8" method="POST">
133
- <button class="button" name="party" type="submit">PARTY!</button></a></p></form>
133
+ <button class="button" name="party" value="party" type="submit">PARTY!</button></a></p></form>
134
134
</body></html>
135
135
"""
136
136
return html
0 commit comments