Author Topic: Webbotlib, Axon status led solid  (Read 2095 times)

0 Members and 1 Guest are viewing this topic.

Offline tranzparencyTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 1
Webbotlib, Axon status led solid
« on: December 10, 2010, 05:43:26 AM »
Running XP SP2, through VirtualBox on OS X 10.6.5 with an axon.  No problems once env was dialed out.  After goofing off the last week with some SoR code, wanted to try out WebbotLib.

Chose to go simple; just power: no servos, sensors, etc.  Followed the docs to the letter: downloaded, put in said folder, created new project, added libs in config, etc.  Copied HelloWorld code over and Built the project.

No errors.  Fbooted the .hex to the axon.  Nice and quick with SP2, thank god I removed SP3 (thanks Admin!). Fired up HyperTerminal, and turned on the axon. Zero.  No response.  Went through the 101 things I did wrong and found nothing obvious at 2am ;) Also noticed the status led is on full-time now.

So, I reflashed the axon with the last project I was working on.  Fired up HyperTerm and there it was.  Sensors, data, blah blah.. No status light.

Tried the webbot code again.  Same issue: no repeating "HelloWorld" after 1 sec, and axon status led is constantly on.  Any ideas?  Thanks.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Webbotlib, Axon status led solid
« Reply #1 on: December 10, 2010, 11:59:53 AM »
Upload your relevant HelloWorld code and I'll have a look.

Offline tranzparencyTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 1
Re: Webbotlib, Axon status led solid
« Reply #2 on: December 10, 2010, 04:35:27 PM »
Code: [Select]
// Place any #define statements here before you include ANY other files
 
// You must ALWAYS specify the board you are using
// These are all in the 'sys' folder e.g.
#include "sys/axon.h" // I am using an Axon
 
// Now include any other files that are needed here
#include "uart.h"
#include "rprintf.h"
 
// Now create any global variables such as motors, servos, sensors etc
 
// This routine is called once only and allows you to do set up the hardware
// Dont use any 'clock' functions here - use 'delay' functions instead
void appInitHardware(void)
{
rprintf("Initializing Hardware...\r\n");
    // Set UART0 to 19200 baud
    uartInit(UART0, 19200);
    // Tell rprintf to output to UART0
    rprintfInit(&uart0SendByte);
}

// This routine is called once to allow you to set up any other variables in your program
// You can use 'clock' function here.
// The loopStart parameter has the current clock value in µS
TICK_COUNT appInitSoftware(TICK_COUNT loopStart)
{
    return 0; // dont pause after
}
 
// This routine is called repeatedly - it?s your main loop
TICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart)
{
    rprintf("Hello world\n");
    return 1000000; // wait for 1 second before calling me again. 1000000us = 1 second
}
« Last Edit: December 10, 2010, 04:40:00 PM by tranzparency »

Offline tranzparencyTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 1
Re: Webbotlib, Axon status led solid
« Reply #3 on: December 10, 2010, 07:41:06 PM »
Still tinkering around with that hello world code from the Webbot docs but couldn't get any output.  So decided to try the WebbotLib Project Designer.  Added power source and sensor.  Generated the files and flashed the Axon.  The status light still stays on but the sensor response/values works perfectly now.

Still digging through the generated code.  But is the status light set on as default?

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Webbotlib, Axon status led solid
« Reply #4 on: December 10, 2010, 09:05:04 PM »
I'm not sure what your hardware is set up to do, but your code is using UART0 but the Axon USB uses UART1.

Also, try turning off the LED in code.

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: Webbotlib, Axon status led solid
« Reply #5 on: December 12, 2010, 11:08:34 AM »
Yep, the status led is on by default. This is beacuse some boards only have a single LED so its useful for the statusLED to act as a 'power on' indicator.
As Admin says: you could turn it off in appInitHardware by calling

Code: [Select]
statusLED_off();

Also as Admin has said - think your original code is not doing what you expect as it uses Uart 0 whereas the USB port is UART 1. So you could change your code to use UART1:-
Code: [Select]
// Place any #define statements here before you include ANY other files
 
// You must ALWAYS specify the board you are using
// These are all in the 'sys' folder e.g.
#include "sys/axon.h" // I am using an Axon
 
// Now include any other files that are needed here
#include "uart.h"
#include "rprintf.h"
 
// Now create any global variables such as motors, servos, sensors etc
 
// This routine is called once only and allows you to do set up the hardware
// Dont use any 'clock' functions here - use 'delay' functions instead
void appInitHardware(void)
{
rprintf("Initializing Hardware...\r\n");
    // Set UART1 to 19200 baud
    uartInit(UART1, 19200);
    // Tell rprintf to output to UART1
    rprintfInit(&uart1SendByte);
}

// This routine is called once to allow you to set up any other variables in your program
// You can use 'clock' function here.
// The loopStart parameter has the current clock value in µS
TICK_COUNT appInitSoftware(TICK_COUNT loopStart)
{
    return 0; // dont pause after
}
 
// This routine is called repeatedly - it?s your main loop
TICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart)
{
    rprintf("Hello world\n");
    return 1000000; // wait for 1 second before calling me again. 1000000us = 1 second
}
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline tranzparencyTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 1
Re: Webbotlib, Axon status led solid
« Reply #6 on: December 14, 2010, 07:33:22 AM »
Thanks for the reply.

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: Webbotlib, Axon status led solid
« Reply #7 on: December 14, 2010, 02:06:04 PM »
For info to others:-

The reason the code example shows UART0 is that WebbotLib is designed to work with various ATmegas and boards.
Chips like the ATMega328 only have one uart (UART0) - so for the code example to be as portable as possible then it uses UART0.

But thanks to 'transparency' - I will attempt to remember to highlight the change for the Axon(s) for a future release.
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

 


Get Your Ad Here