Hello fellow Arduinauts. Recently I’ve become entranced and immersed in Arduino everything. I absolutely love everything about the entire maker movement. enough personal backstory, let’s get to the issue at hand. After setting up an LCD module model 1602 and printing my initial “hello world!” statement I moved on to displaying variables. The initial variable I was instructed to display was Pi. seemed fairly straight forward and on I went entering my code, which I will post below. But I encountered a randomizing of the digits past the 5th place.
// LCD module 1602 used to display characters as opposed to the serial port
LiquidCrystal lcd(4,5,6,7,8,9);// pins for RS, E, DB4, DB5, DB6, DB7
// schematic for LCD and program used are from "Arduino Workshop" by John Boxall p.149 & 151
float pi = 3.141592654;
lcd.print(pi,5);// this is the point at which the number used remains constant, when 6 is entered the number in the 6th decimal place is random
my issue is more of an object of curiosity rather than need.
does anyone know the reason for this randomization after the 5th decimal place?
AWOL's subtle hint is intended to lead you to discover that there is no "7th+" decimal place.
Did that come across as subtle?
hey did you know that simply saying it isn't something I can do with the arduino would have sufficed. but know that acting superior for knowledge you possess is a limited and fast ending endeavor right? in less than a year i'll know a good deal of what anyone else knows about this subject, it's not remotely difficult. and im barely getting started.i asked a question not realizing why it was stupid and get snarky re directs to the wiki article telling me the same. despite that fact i still do appreciate the guidance on my rookie error. granted if i came here for subtlety I'd be more of a fool i suppose. what i did come for was answers and no matter the packaging i appreciate the quick response and the proper information. ive never before seen a single statement like what AWOL said could have so much "god you're stupid" in it. hahaha i'll try to fix my idiocy before gracing your eyes with my nonsensical thoughts again. was that enough self flagellation to repent for my sin oh great moderator of the universe?
- AWOL condemns me to buuurn!
noooooo. but being as it is my first question on here besides being stupid did i structure it correctly?
Is your shift key broken?
What is "snarky"?
Where is "snarky"?
Let's critique: use of code tags on first post. Good.
Who said it wasn't something you could do with an Arduino?
Eight bit Arduinos have 32 bit floats and doubles, but 32 bit Arduinos have 32 bit floats and 64 bit doubles.
Try a Due.
Actually, a " float" is usually 32 bit, no matter what platform, so I'm surprised a Pi gave different results.
No I was just being lazy. Probably goes a long way to explaining why I missed the obvious answer to my own question. I was just joking around, you weren't snarky, I projected that tone over the link it didn't actually come across that way, if that makes sense.
I didn't use a Pi I was just using it as the float value. I only have the Uno currently. The whole reason I hit this issue was I saw in my lesson that the program to display the value of Pi on my LCD only had it printing to the 3rd place but because they were using the variable to the 9th place in the line where I defined the float, and I wrongly assumed I could simply change the
5(it was originally a 3 in the book's example code)to a 9 and view the entire value they had listed. When it didn't work I became puzzled and began immediately over thinking the entire thing and brought it here.
Thank you for your time. I do appreciate it greatly! Even if I fear I may have wasted it with this Topic.