Jump to content
43oh

Recommended Posts

Hi,

I have a EK-TM4C1294XL evaluation kit and a BOOSTXL-EDUMKII board connected to it.

I cannot get the RGB_LED_RANDOM example to work.

The LED's work as if i change the analogWrite(ledRed, random(255)) to analogWrite(ledRed, 255) the LED comes on. Any value other than 255 results in the LED staying OFF.

I have jumper J5 in the top position (1-2) which i believe is correct.

What do i need to do, to get the PWM running?

thanks

Link to post
Share on other sites

Ive just tried that with no luck:-


int ledRed = 39, ledBlue = 37, ledGreen = 38;    // LED connected to digital pin 9

void setup()  { 
  // Initialize the pseudo-random number generator
  randomSeed(1);

void loop()  { 

uint8_t number = 254;
analogWrite(ledRed, number);
 
  // sets the value (range from 0 to 255) for 3 RGB channels:
 // analogWrite(ledRed, random(255));
 // analogWrite(ledBlue, random(255));
//  analogWrite(ledGreen, random(255));    
  // wait for 30 milliseconds before changing the color again
 // delay(300);                            

}

 

If i set uint8_t number = 255 then the LED turns on (RED), but any number other than 255 means it never comes on.

 

Link to post
Share on other sites

This code works for me. [edit] on LaunchPad LM4F120H5QR / TM4C123GH6PM. [/edit]

#include "Energia.h"

void setup()
{
    pinMode(RED_LED, OUTPUT);
    pinMode(GREEN_LED, OUTPUT);
    pinMode(BLUE_LED, OUTPUT);

    Serial.begin(9600);
    Serial.println();
    Serial.println("RGB\tR\tG\tB");
}

void writeRGB(uint8_t valueRed, uint8_t valueGreen, uint8_t valueBlue)
{
    analogWrite(RED_LED, valueRed);
    analogWrite(GREEN_LED, valueGreen);
    analogWrite(BLUE_LED, valueBlue);
}

void loop()
{
    uint8_t valueRed = random(255);
    uint8_t valueGreen = random(255);
    uint8_t valueBlue = random(255);
    Serial.print(millis());
    Serial.print("\t");
    Serial.print(valueRed);
    Serial.print("\t");
    Serial.print(valueGreen);
    Serial.print("\t");
    Serial.print(valueBlue);
    Serial.println();
    writeRGB(valueRed, valueGreen, valueBlue);
    delay(333);
}

And the video at vimeo.com/256190702.

 

Link to post
Share on other sites

This still isn't working.

I've taken my code and added the pinMode() into the setup routine. Still no joy.

Your supplied code didn't compile giving me errors that 'BLUE_LED' was not declared in this scope. I re-wrote the code so that i could get it to compile and whilst i'm seeing the serial port information, the RGB LED isn't coming on.

As i can't get the PWM to work i have to now point the finger at the underlying code behind analogWrite() for my board EK-TMC1294XL.

How would i go about writing my own analogWrite() routine, i.e. writing/reading to the micro registers directly?

Link to post
Share on other sites

But those are the LED's that are on the EK-TM4C1294XL board.

My query relates to the RGB LED that is on the BOOSTXL-EDUMKII board.

The RGB LED is on pins 39,38,37 of the 40 pin stackable connectors. These map to header C1 on the EK-TM4C1294XL pins 2,3,4 which have PWM allocated to them.

I'm not convinced the analogWrite(pin,duty) is supported on my board and im also confused as to what i pass in the pin argument - is it 39,38 or 37 or 2,3,4 depending on which pin i want the PWM on? This isn't clear.

Thanks for all your help but i think im going to give up on this shortly.

Link to post
Share on other sites

Sorry, im still not getting this!

I've attached the pin-outs for the eval board and also the booster pack.

The eval board shows PWM assigned to the pins that map to the pins on the boostxl-edumkii RGB LED.

To me, this shows that PWM should be available on the pins that map to the RGB LED. 

If the routine analogWrite(pin,duty) is able to provide PWM to those pins (the micro can) then all should be well.

boostxl-edumkii pin outs.JPG

ek-tm4c1294xl pin outs.JPG

Link to post
Share on other sites

Rei,

could i ask one more question of you, not relate to the previous, but ill keep it here if thats ok?

Im looking at some code that blinks an LED - BlinkWithoutDelay and it contains a line "const int ledPin =  GREEN_LED;      // the number of the LED pin"

Where is the compiler getting the value of GREEN_LED from? I would like to see how this relates to the micro pin and then onto the booster pack pin or expansion port pin.

From connecting up its on Pin 85 on the expansion header, but id like to see where this is declared.

Thanks

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...