Main Site Documentation

Problem to get the status of an LED (Fez Panda C #)


#1

Hello,
Currently class STI2D end, I realize a project.
My project is to vary the brightness of an LED using the touch screen Fez Touch. Then I have to see the status of the LED on an HTML page.
Everything works fine, the connection between the PC and the card works.
But I have a problem I can not seem to get the state of the LED.
I’ve put my program in image below,
If you could help me, it would be very helpful.
Thank you in advance, good day :slight_smile:


#2

How and where do you get the state of the led?

You have different things named “White” in your code. It is good recommendation to use unique names to avoid confusion and errors.

And finally you can use code tags (second grey button with "1"s and "0"s) to include you code as a nicely formatted and syntax highlighted text instead of attaching images.


#3

You need a variable to hold the current value of the PWM value, and then use that value in the HTML output.

When your slider on your Touch changes, it only changes the PWM object. You would also need to save the value in there as well.

Something like this:

Variable:

byte whiteValue = 0;

In the HMTL:

"<p>La valeur du PWm de la LED est " + 
whiteValue.ToString() + </li></p>"

In the slider:

static void silder_White_ValueChanged(int val)
{
     whiteValue = (byte)val:
     lbl_White.Text = val.ToString();
}