This is because these are SPI port pins that are used to control the Ethernet chip and SD card. NOTE: Pins 50 to 53 (four pins) can not be used as outputs when using the Ethernet shield. Arduino MEGA LED Connection Circuit Diagram Only the first two and last two LEDs with series resistors are shown in the circuit as the rest of the LEDs are connected in the same way sequentially from pin 26 to pin 49 of the Arduino MEGA. The circuit diagram shows how the LEDs are connected to the Arduino. A 2GB micro SD card is used to store the web page that is hosted by the Arduino. Hardware and Circuit DiagramĪn Arduino MEGA 2560 and Arduino Ethernet shield are used in this project. Because of this, the other major change to the base code was to make use of loops to access the 24 outputs sequentially in the Arduino code and JavaScript. It would be a lot of work and also the HTML file would be bigger if this project accessed the outputs directly using unique names like the project that it is based on does. The code in this tutorial is based on part 16 of the web server tutorial – SD card web server I/O but is modified to use only outputs for the 24 outputs. All the basics of how an Arduino web server, web pages and Ajax work are explained in the Arduino Ethernet web server tutorial on this website. The code for this tutorial is listed and explained below, but a basic understanding of the technologies used in this tutorial will be needed. The JavaScript that is embedded in the page communicates with the Arduino web server using Ajax after the web page has been loaded to the web browser. The Arduino MEGA and Ethernet shield are programmed to behave as a web server that serves up the web page from the micro SD card when a web browser connects to the server and requests the page. The micro SD card is inserted into the micro SD card socket on the Ethernet shield. The index.htm page contains HTML, CSS and JavaScript. The code consists of an Arduino sketch that is loaded to the Arduino MEGA and an index.htm file that is copied to the micro SD card. Understanding the Code Basic Code Structure The video below shows the web page and circuit working. Pins 26 to 49 of the MEGA are used as outputs and connected to the LEDs. To demonstrate the outputs working, 24 LEDs with series resistors are connected to 24 pins of the Arduino MEGA. Ajax is used on the web page and Arduino to control the LEDs and communicate between the web page and the Arduino via the Ethernet connection.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |