GPIO Just blink once

PAWI
New Member Posts: 2
Hi,
I'm trying to light up a led for 10 seconds with this code
But the led only blink once very fast.
Is there a way to keep the GPIO on for several seconds
This is my code
UInt32 err = EAPI.EApiLibInitialize();
if (err != EAPI.EAPI_STATUS_INITIALIZED)
{
Console.WriteLine("Can't initialize the application: " + err.ToString());
Environment.Exit(0);
}
UInt32 nPinCount = 0;
UInt32 bDioDisable = 0;
EAPI.EApiGPIOGetCaps(EAPI.EAPI_GPIO_GPIO_ID((UInt32)relayNumber), ref nPinCount, ref bDioDisable);
if (bDioDisable != 0x01)
{
err = EAPI.EApiGPIOSetDirection(EAPI.EAPI_GPIO_GPIO_ID((UInt32)relayNumber), 0xFFFFFFFF, EAPI.EAPI_GPIO_OUTPUT);
err = EAPI.EApiGPIOSetLevel(EAPI.EAPI_GPIO_GPIO_ID((UInt32)relayNumber), 0xFFFFFFFF, EAPI.EAPI_GPIO_HIGH);
Console.WriteLine("Pull relay for {0} seconds.", 10);
System.Threading.Thread.Sleep(10000);
err = EAPI.EApiGPIOSetDirection(EAPI.EAPI_GPIO_GPIO_ID((UInt32)relayNumber), 0xFFFFFFFF, EAPI.EAPI_GPIO_OUTPUT);
err = EAPI.EApiGPIOSetLevel(EAPI.EAPI_GPIO_GPIO_ID((UInt32)relayNumber), 0xFFFFFFFF, EAPI.EAPI_GPIO_LOW);
Console.WriteLine("############### COMPLETED ##################");
} else
{
Console.WriteLine("############### GPIO Disabled ##################");
}
I'm trying to light up a led for 10 seconds with this code
But the led only blink once very fast.
Is there a way to keep the GPIO on for several seconds
This is my code
UInt32 err = EAPI.EApiLibInitialize();
if (err != EAPI.EAPI_STATUS_INITIALIZED)
{
Console.WriteLine("Can't initialize the application: " + err.ToString());
Environment.Exit(0);
}
UInt32 nPinCount = 0;
UInt32 bDioDisable = 0;
EAPI.EApiGPIOGetCaps(EAPI.EAPI_GPIO_GPIO_ID((UInt32)relayNumber), ref nPinCount, ref bDioDisable);
if (bDioDisable != 0x01)
{
err = EAPI.EApiGPIOSetDirection(EAPI.EAPI_GPIO_GPIO_ID((UInt32)relayNumber), 0xFFFFFFFF, EAPI.EAPI_GPIO_OUTPUT);
err = EAPI.EApiGPIOSetLevel(EAPI.EAPI_GPIO_GPIO_ID((UInt32)relayNumber), 0xFFFFFFFF, EAPI.EAPI_GPIO_HIGH);
Console.WriteLine("Pull relay for {0} seconds.", 10);
System.Threading.Thread.Sleep(10000);
err = EAPI.EApiGPIOSetDirection(EAPI.EAPI_GPIO_GPIO_ID((UInt32)relayNumber), 0xFFFFFFFF, EAPI.EAPI_GPIO_OUTPUT);
err = EAPI.EApiGPIOSetLevel(EAPI.EAPI_GPIO_GPIO_ID((UInt32)relayNumber), 0xFFFFFFFF, EAPI.EAPI_GPIO_LOW);
Console.WriteLine("############### COMPLETED ##################");
} else
{
Console.WriteLine("############### GPIO Disabled ##################");
}
Comments
-
I found the error!
The UP pinout spec is incorrect.
Use the zero based pin location instead.
Eg if you want to use GPIO3 then you should use EAPI_GPIO_GPIO_ID(10)
GPIO4 = 12
GPIO5 = 14
GPIO18 = 15
etc. -
We just got feedback from our SW team.
*******
In our Windows EAPI, GPIO0 should be related to EAPI_GPIO_GPIO_ID(0), GPIO1 = EAPI_GPIO_GPIO_ID(1), etc…
I can’t figure out why the user need to use GPIO with such strange order.
*******
Can you specify the problem and where the error is ?
Categories
- All Categories
- 105 Announcements & News
- 54 Product News - New Product/Product Change Notice/ End-of-life
- 186 Welcome Developers!
- 55 Unboxing & Project Sharing
- 50 Tech Updates
- 693 UP Products
- 11 UP 7000
- 1 UP Squared i12
- 10 UP Xtreme i12
- 11 UP Squared Pro 7000
- 1 UP Element i12 Edge
- 19 UP Squared V2
- 59 UP 4000
- 24 UP Xtreme i11
- 35 UP Squared 6000
- 60 UP Squared Pro
- 143 UP Xtreme
- 837 UP Squared
- 1.4K UP Board
- 89 UP Core Plus
- 222 UP Core
- 3 UP Xtreme Lite
- 44 UP AI Edge
- 216 Starter Kits & Peripheral