Pages: [1]   Go Down
Author Topic: Help with homework problem decimal to hex conversion on arduino uno  (Read 2129 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Delete
« Last Edit: July 30, 2013, 10:58:23 pm by Sharkbiteattack » Logged

UK
Offline Offline
God Member
*****
Karma: 17
Posts: 568
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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'.
Logged

Offline Offline
Edison Member
*
Karma: 36
Posts: leet
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
//convert character input to number
      //CODE LINE MISSING HERE
      //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:
//display the result
 //CODE LINE MISSING HERE
 //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?   

   

Logged

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 47
Posts: 2925
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@DVDdoug   61?...  = =
Quote
For example, in a string the (ASCII encoded) letter 'A' is represented by 61 65 (decimal).
 ??

Doc


* asciifull.gif (27.35 KB, 715x488 - viewed 16 times.)
« Last Edit: May 01, 2013, 06:31:12 pm by Docedison » Logged

--> 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

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.)
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Pages: [1]   Go Up
Jump to: