Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

Simple LED flash tutorial

Based on DMP's Vortex processor / SoC this board is a full computer capable of running a standard Windows and Linux installation on the backpack of your robot.
3 postsPage 1 of 1
3 postsPage 1 of 1

Simple LED flash tutorial

Post by dsaner » Sun Oct 11, 2009 12:42 am

Post by dsaner
Sun Oct 11, 2009 12:42 am

Could someone please post a simple tutorial on how to get an LED to flash. I am not a C++ developer, but do make a living programming C# and over the past sever hours of trying to get anywhere about all I get is :
Error 1 fatal error LNK1107: invalid or corrupt file: cannot read at 0x2B8 c:\Documents and Settings\dsaner\My Documents\Visual Studio 2005\Projects\LEDTest\LEDTest\RoBoIO.dll 1

I have used many different microcontrollers and I have seen one that did not post a simple tutorial to flash an LED.

The documentation is really bad and most of the posts are focused at installing OS on the board not on using the board. It would be greatly appreciated if someone could post a simple tutorial like this.

Thanks,
-Don
Could someone please post a simple tutorial on how to get an LED to flash. I am not a C++ developer, but do make a living programming C# and over the past sever hours of trying to get anywhere about all I get is :
Error 1 fatal error LNK1107: invalid or corrupt file: cannot read at 0x2B8 c:\Documents and Settings\dsaner\My Documents\Visual Studio 2005\Projects\LEDTest\LEDTest\RoBoIO.dll 1

I have used many different microcontrollers and I have seen one that did not post a simple tutorial to flash an LED.

The documentation is really bad and most of the posts are focused at installing OS on the board not on using the board. It would be greatly appreciated if someone could post a simple tutorial like this.

Thanks,
-Don
dsaner
Newbie
Newbie
Posts: 4
Joined: Sun Oct 11, 2009 12:38 am

Some Progress...

Post by dsaner » Sun Oct 11, 2009 1:34 am

Post by dsaner
Sun Oct 11, 2009 1:34 am

So, Rather than using the binary release DLL I incoporated a new project into the source provided and have this code (of course it does not work). I have tested the LED circuit and it does light up when the wire attached to the same point from the microcontroller. Is my roboard broken. It is really crazy that you do not provide a simple app so people can at least see if their board works. Providing a sample app for a humanoid robot as the only on is crazy. Come on....This expensive and you should have some simple samples people can run :

// LEDConsole.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <stdio>
#include <conio>

#include "roboard_dll.h"

int _tmain(int argc, _TCHAR* argv[])
{
if (rcservo_Initialize(RCSERVO_USENOCHANNEL)) {
printf("set GPIO pin 17 (PWM channel 17) to high\n");
rcservo_Outp(0,1);
getch();

printf("Close the above test\n");
rcservo_Close();
}
return 0;
}
So, Rather than using the binary release DLL I incoporated a new project into the source provided and have this code (of course it does not work). I have tested the LED circuit and it does light up when the wire attached to the same point from the microcontroller. Is my roboard broken. It is really crazy that you do not provide a simple app so people can at least see if their board works. Providing a sample app for a humanoid robot as the only on is crazy. Come on....This expensive and you should have some simple samples people can run :

// LEDConsole.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <stdio>
#include <conio>

#include "roboard_dll.h"

int _tmain(int argc, _TCHAR* argv[])
{
if (rcservo_Initialize(RCSERVO_USENOCHANNEL)) {
printf("set GPIO pin 17 (PWM channel 17) to high\n");
rcservo_Outp(0,1);
getch();

printf("Close the above test\n");
rcservo_Close();
}
return 0;
}
dsaner
Newbie
Newbie
Posts: 4
Joined: Sun Oct 11, 2009 12:38 am

Got IT!!!!!

Post by dsaner » Sun Oct 11, 2009 2:30 am

Post by dsaner
Sun Oct 11, 2009 2:30 am

Okay - after much mucking around, I finally have it working. The one big gotcha is that the lines on the circuit board are numbered 1 - 24 and in code they need to be referenced 0 - 23, so when you are plugged into S3 you are actually at channel 2!....grrrrr

At any rate, if you download the source code from the roboard site and open it in VS2005, then right click the solution and "Add New Project" and "Win32 Console App" then use the code below, it will flash an LED hooked up to S3 (channel 2). The circuit is simple just an led with a limiting resistor to ground.

It could be that I am just stupid, but if others are challenged getting started with programming the roboard, I think a led flasher is a good place to start. Oh and you need install VC2005 SP1 Redistributable Package (http://www.microsoft.com/downloads/deta ... laylang=en) under XP

This code will flash an LED 1000 times.

// LEDConsole.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <stdio>
#include <conio>
#include "windows.h"

#include "roboard_dll.h"

int _tmain(int argc, _TCHAR* argv[])
{
int i = 0;
if (rcservo_Initialize(RCSERVO_USENOCHANNEL)) {
while(i < 1000)
{
printf("set GPIO pin 2 (PWM channel 2) to high\n");
rcservo_Outp(2,1);

Sleep(1000);

printf("set GPIO pin 2 (PWM channel 2) to low\n");
rcservo_Outp(2,0);

Sleep(1000);
}
rcservo_Close();
}
return 0;
}
Okay - after much mucking around, I finally have it working. The one big gotcha is that the lines on the circuit board are numbered 1 - 24 and in code they need to be referenced 0 - 23, so when you are plugged into S3 you are actually at channel 2!....grrrrr

At any rate, if you download the source code from the roboard site and open it in VS2005, then right click the solution and "Add New Project" and "Win32 Console App" then use the code below, it will flash an LED hooked up to S3 (channel 2). The circuit is simple just an led with a limiting resistor to ground.

It could be that I am just stupid, but if others are challenged getting started with programming the roboard, I think a led flasher is a good place to start. Oh and you need install VC2005 SP1 Redistributable Package (http://www.microsoft.com/downloads/deta ... laylang=en) under XP

This code will flash an LED 1000 times.

// LEDConsole.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <stdio>
#include <conio>
#include "windows.h"

#include "roboard_dll.h"

int _tmain(int argc, _TCHAR* argv[])
{
int i = 0;
if (rcservo_Initialize(RCSERVO_USENOCHANNEL)) {
while(i < 1000)
{
printf("set GPIO pin 2 (PWM channel 2) to high\n");
rcservo_Outp(2,1);

Sleep(1000);

printf("set GPIO pin 2 (PWM channel 2) to low\n");
rcservo_Outp(2,0);

Sleep(1000);
}
rcservo_Close();
}
return 0;
}
dsaner
Newbie
Newbie
Posts: 4
Joined: Sun Oct 11, 2009 12:38 am


3 postsPage 1 of 1
3 postsPage 1 of 1