Example of use myEthernet: Request potentiometer position

Project

    In this project the myEthernet should be connected on a myAVR Board MK2 USB and the analogue value of the potentiometer position should be displayed on a website.

    The command is replaced by the status of the pin which selected. Depending on the configuration of pins, different values are shown.

Required hardware

    When the pin is configurated as digital input then only 0 or 1 can be outputted (by configuration as analogue input only values from 0 to 1024 can be outputted). The pin13 on the myEthernet relates to PORT C.1 on the myAVR Board MK2 USB. The command v13~%x is also replaced by the status of the pin. The %x formates the output as hexadecimal number. Standard happens the output as integer number.

    You will find more examples to the formatting characters in the "Example of use myEthernet: Shared RAM".

    Note

    This example refers to the "Example of use myEthernet: Pin configuration". We recommend you to look at first to the "Example of use myEthernet: Pin configuration".

Procedure

    Step 1:
    Create a HTM-file with the name poti.htm.

    Step 2:
    Write the following source code in it.

    Step 3:
    Copy the file on the microSD-card.

    Step 4:
    Insert the microSD-card in the myEthernet, connect the power supply on the myEthernet and connect it via the network cable with a PC.

    Step 5:
    Connect the myEthernet with the myAVR Board MK2 USB like it is shown in the picture. Put a patch cable from PORT C.1 to the potentiometer 1.

    Step 6:
    Configurate pin 13 as analogue input. This is explained in the "Example of use myEthernet: Pin configuraton".

    Step 7:
    Open a page in a web browser. Write in the address line the IP address and the name of the htm-file e.g. http://192.168.178.96/poti.htm
    On the page you see the analogue value. If you turn on the potentiometer and actualize the page then the value is changed.

Downloads

Shopping list:


««« Back to the picture gallery  

Our regional partners

Business partner wanted!

To expand our sales area we are looking for partners to represent our products and interests of the Laser & Co. Solutions GmbH.

For beginners

STM32-Produktlinie

mySmartUSB MK2