File tree 1 file changed +36
-0
lines changed
1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ # SPDX-FileCopyrightText: 2023 Tim C for Adafruit Industries
2
+ # SPDX-License-Identifier: MIT
3
+
4
+ import board
5
+ import digitalio
6
+ from adafruit_wiznet5k .adafruit_wiznet5k import WIZNET5K
7
+ import adafruit_wiznet5k .adafruit_wiznet5k_socket as socket
8
+ from adafruit_httpserver import Server , Request , Response
9
+
10
+ print ("Wiznet5k HTTPServer Test" )
11
+
12
+ # For Adafruit Ethernet FeatherWing
13
+ cs = digitalio .DigitalInOut (board .D10 )
14
+ # For Particle Ethernet FeatherWing
15
+ # cs = digitalio.DigitalInOut(board.D5)
16
+ spi_bus = board .SPI ()
17
+
18
+ # Initialize ethernet interface with DHCP
19
+ eth = WIZNET5K (spi_bus , cs )
20
+
21
+ # set the interface on the socket source
22
+ socket .set_interface (eth )
23
+
24
+ # initialize the server
25
+ server = Server (socket , "/static" , debug = True )
26
+
27
+
28
+ @server .route ("/" )
29
+ def base (request : Request ):
30
+ """
31
+ Serve a default static plain text message.
32
+ """
33
+ return Response (request , "Hello from the CircuitPython HTTP Server!" )
34
+
35
+
36
+ server .serve_forever (str (eth .pretty_ip (eth .ip_address )))
You can’t perform that action at this time.
0 commit comments