Announcement

Collapse
No announcement yet.

LED - Blinking LED

Collapse
X
Collapse

  • LED - Blinking LED


    Tutorial Video



    Hardware

    About Built-in LED

    There are some LEDs are built-in on PHPoC board. This helps user quickly get started without wiring anything. These LED were already connected to IO pin of PHPoC device.

    How to control built-in LED:
    • These LEDs are turned ON by setting IO pin of PHPoC device to LOW (0 V).
    • These LEDs are turned OFF by setting IO pin of PHPoC device to HIGH (3.3 V).


    Quick Steps

    Source code of this example is a part of PHPoC Support Packet (PSP). You need to:
    • Download PHPoC Support Package.
    • Upload example\p4s\01.php_task\01.uio_ob_led to PHPoC Blue/Black.
    • Click "Run" button on PHPoC Debugger.
    If you use PHPoC for the first time, see How To Use PSP.


    Source Code

    Source files includes:
    • init.php: this file is run when PHPoC system is powered or reset. It is used to specify which file is run is system loop.
    • task0.php: this file is run in system loop of PHPoC devices.

    init.php

    This file is run when PHPoC system is powered or reset. It is used to specify that task0.php is run is system loop.
    PHP Code:
    <?php

    system
    ("php task0.php");

    ?>



    task0.php

    [Full Code]
    PHP Code:
    <?php

    if(_SERVER("REQUEST_METHOD"))
     exit; 
    // avoid php execution via http request

    include_once "/lib/sd_340.php";

    echo 
    "PHPoC example : P4S-34X / UIO / blink on-board LED\r\n";

    uio_setup(030"out high");
    uio_setup(031"out high");

    while(
    1)
    {
     
    uio_out(030LOW);
     
    uio_out(031HIGH);
     
    usleep(250000);

     
    uio_out(030HIGH);
     
    uio_out(031LOW);
     
    usleep(250000);
    }

    ?>



    [Explanation]

    Source code of this file does:
    • Setup IO pin to output mode and initialize IO pin state to HIGH (LED is off).
    In infinite loop:
    • Tongle output pin between LOW and HIGH to blink on-board LED.



    See Also

    Other Resources
    Last edited by support; 02-09-2018, 10:00 AM.
      Posting comments is disabled.

    Categories

    Collapse

    Latest Articles

    Collapse

    • Arduino - RS-485 Expansion Board
      support
      PES-2607 is an easy-to-use RS422/RS485 Expansion Board for Arduino Uno and Mega, which allows Arduino to exchange data with serial device via RS422 or RS485.
      Especially, Arduino does NOT use UART pins to communicate with RS422/RS485 expansion board. Therefore, users can use Arduino UART pins for other purposes.
      Moreover, A single Arduino Uno/Mega can communicate with multiple RS422/RS485 expansion boards (up to 14) without using Arduino UART pins.

      Library and examples for...
      11-13-2018, 03:45 PM
    • Arduino - RS-422 Expansion Board
      support
      PES-2607 is an easy-to-use RS422/RS485 Expansion Board for Arduino Uno and Mega, which allows Arduino to exchange data with serial device via RS422 or RS485.
      Especially, Arduino does NOT use UART pins to communicate with RS422/RS485 expansion board. Therefore, users can use Arduino UART pins for other purposes.
      Moreover, A single Arduino Uno/Mega can communicate with multiple RS422/RS485 expansion boards (up to 14) without using Arduino UART pins.

      Library and examples for...
      11-13-2018, 03:44 PM
    • Arduino - RS-232 Expansion Board
      support
      PES-2606 is an easy-to-use RS-232 Expansion Board for Arduino Uno and Mega, which allows Arduino to exchange data with serial device via RS-232.
      Especially, Arduino does NOT use UART pins to communicate with RS-232 expansion board. Therefore, users can use Arduino UART pins for other purposes.
      Moreover, A single Arduino Uno/Mega can communicate with multiple RS-232 expansion boards (up to 14) without using Arduino UART pins.

      Library and example for the RS-232 expansion board...
      11-13-2018, 03:43 PM
    • Arduino - Stepper Motor Controller
      support
      PES-2605 is an easy-to-use stepper motor controller for Arduino Uno and Mega, which uses micro-stepping method to precisely control stepper motor.
      Library and example for the stepper motor controller are part of of PhpocExpansion library for Arduino. The library reference is available here.

      This tutorial shows how to use the step motor controller with an example of PhpocExpansion library for Arduino.


      Hardware Required...
      11-13-2018, 03:41 PM
    • Arduino - DC Motor Controller
      support
      PES-2604 is an easy-to-use DC motor controller for Arduino Uno and Mega.
      Library and example for the DC motor controller are part of of PhpocExpansion library for Arduino. The library reference is available here.

      This tutorial shows how to use the DC motor controller with an example of PhpocExpansion library for Arduino.


      Hardware Required...
      11-13-2018, 03:40 PM
    • Arduino - Digital Input Board
      support
      PES-2602 is an easy-to-use 4-port Input Expansion Board for Arduino Uno and Mega, which allows Arduino to monitor state of DC electric device. In addition, it can monitor NPN, PNP and dry contact(relay).
      Library and example for the 4-port input expansion board are part of of PhpocExpansion library for Arduino. The library reference is available here.

      This tutorial shows how to use 4-port input expansion board with an example of PhpocExpansion library for Arduino.

      ...
      11-13-2018, 03:39 PM
    Working...
    X