C code for arduino multi function shield using mfes library.

Hi guys,

i am trying to write a C program for multi function shield with arduino where i want it to run several pieces of code using CASE statement.

i want it to do following:
Choice ‘A’ flashes the LEDs on and off
Choice ‘B’ lights a LED if matching push button is pressed
Choice ‘C’ displays potentiometer value on the 7-segment display
Choice ‘D’ directly displays a number on the 7-segment display.
Choice ‘E’ displays the last 4 push buttons pressed on the 7-segment display.

i have managed to do A-C but still cannot figure out D and E. if someone can help me with that, it would be great.

i have attached my code as a text file.

code.txt (2.73 KB)



Sorry about that.

i have modified the post and added it as an text file.

D seems trivial - you have the code that does it for the 'C' case. Is the issue getting the number to display?

i want to input a number from a web page using php and then want to display that number on the seven seg display.

following is my php code:

<?php /* Display version */ echo "PHP serial extension version ".ser_version(); echo " \r\n"; /* Check if port is already open */ if (ser_isopen() == true ) echo "Port is open \r\n"; else echo "Port is closed \r\n"; /* Open the serial port NOTE: ********** the serial port must be that of the Arduino ********** */ echo "Opening the port ...\r\n"; echo " \r\n"; echo "Result = "; echo ser_open("COM6", 9600, 8, "None", "1", "None"); echo " \r\n"; /* Check if port is open */ if (ser_isopen() == true ) echo "Port is open \r\n"; else echo "Port is closed \r\n"; /* Write command to the Arduino board */ if (isset($_POST['submit'])) { if(isset($_POST['radio'])) { echo "Writing (string) ".$_POST['radio']."\r\n"; echo " \r\n"; echo "Result = "; echo ser_write("".$_POST['radio']."\r\n"); echo " \r\n"; } else{ echo "Please choose any radio button.";} } /* Wait a bit */ echo "Sleeping ...\r\n"; echo " \r\n"; sleep(1); /* See if there is a response */ echo "Bytes available for reading: ".ser_inputcount()." \r\n"; /* Read and display the response */ echo "Reading (string) ...\r\n"; echo " \r\n"; echo "Result = "; $received_data = ser_read(); echo $received_data; echo " \r\n"; /* See if there is any more data */ echo "Bytes available for reading: ".ser_inputcount()." \r\n"; /* Close the serial port */ echo "Closing the port ...\r\n"; echo " \r\n"; echo "Result = "; echo ser_close(); echo " \r\n"; /* Check to see if port is closed */ if (ser_isopen() == true ) echo "Port is open \r\n"; else echo "Port is closed \r\n"; ?>