Go Down

Topic: Help with homework problem decimal to hex conversion on arduino uno (Read 2946 times) previous topic - next topic


May 01, 2013, 11:43 pm Last Edit: Jul 31, 2013, 05:58 am by Sharkbiteattack Reason: 1


He has provided hints in the exact places you need to enter the two correct lines of code.

The whole point of YOUR homework is that YOU are supposed to work it out. Presumably the proceeding lessons were designed to give you the knowledge to complete the task.

Asking someone else on the internet to solve it for you is an old fashioned thing that people of my generation know as 'cheating'.


If I understand your assignment, you only need to add two lines of code?

Code: [Select]
//convert character input to number
      //HINT: Convert input to an integer and store in the number field

I think you just have to convert a number that's in the form of a string, to an integer.  You can look-up the function to do that.

For example, in a string the (ASCII encoded) letter 'A' is represented by 61 (decimal).  The the  character representing the number '1' is not the value one, it's represented by 49 (decimal).

Code: [Select]
//display the result
//HINT: Call to updateDisplay to show the result
It looks like you just have to call the function.   Do you know how to call a function and pass a couple of values into the function?   



May 02, 2013, 01:05 am Last Edit: May 02, 2013, 01:31 am by Docedison Reason: 1
@DVDdoug   61?...  = =
For example, in a string the (ASCII encoded) letter 'A' is represented by 61 65 (decimal).

--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard


So I have this homework assignement I'm really struggling on.  I have a double 7 digit LED display (88) and I have to make it display the hex equivalent of a number 0-255.  Here's the code, there are some code segments missing that need to be filled in to make the program work and I'm stuck. The instructor has given me 2 hints //HINT: Call to updateDisplay to show the result and  //HINT: Convert input to an integer and store in the number field Any help would be appreciated.

Which one of these are you stuck on, and what have you tried so far to solve the problem yourself?

For what it's worth, your instructor has introduced a subtle bug by failing to null-terminate the input string so once you have worked out (or Googled) how to convert a string to a number you will find it doesn't work until you append the null terminator. Personally, I'd recommend appending it after every character is added. (No - I'm not going to tell you how to do that; if you've been set this problem you must be expected to know enough to recognise the concepts and if you don't, ten seconds with Google would explain them to you.)

Go Up