Some days bringing myself to work on a project is the hardest thing in the world. I just want to sit around in my underwear and eat Oreos. This was one of those days. It was difficult to get myself into the headspace for this project. Part of the problem was that I didn't have a clear vision of the tasks. As you may have noticed there is no To Do list for this project because it hasn't been written yet. That list is great for keeping on track because just saying "Gotta do the programming," makes it seem like the program is some great nebulous task which is intimidating. The best thing I can do for myself is break it down into bite-size tasks.
This isn't a short list but each of those things can be done in less than 30 minutes. Trying to tackle one of those items by itself usually leads to work on the other tasks by proxy. For example, when I made that list as an example I started the To Do list for this project.
Last night I started on the pseudo code with the intent of writing the code body. It turned out the more logical task to start was writing the functions which would translate a potentiometer position into a time and a tea name. Once I compromised with myself that I would sleep after writing those two functions my focus returned and I enjoyed writing the functions. If you look at the pseudo code I've written it's mostly straight code which is not a great practice.
Enough background.
----------
A chart was made which shows which tea name should appear according to which time has been selected. The chart breaks down the six minutes (1-7 minutes) into 24 segments, each 15 seconds long. The name of the tea was written next to the time segment where it displays. Some teas, like Chinese Green only displayed during one 15 second segment while Herbal displayed for the last two minutes. This was intentional since the main focus should be the time.
The code was written for the function which will turn a potentiometer reading into a time in whole seconds. These times were from one to seven minutes and went in fifteen second intervals. The idea was that the potentiometer value would be translated into the range of zero to 24. That number would be multiplied by 15. That gives a time value of zero to 360 seconds. After 60 seconds are added the time frame is now 60 seconds to 420 seconds or one to seven minutes. This code could have been written in fewer lines but expanding it to a few lines makes the concept more evident.
With the chart made earlier the code for the function which takes a time value and converts it to a tea name was made. This works by climbing up a list and checking for a true function. As soon as a time is found which agrees with an IF statement the return function exits this function and sends a string with the tea name back. There was also a check to be sure that the time integer being fed to this function is in the desired range or if the number being received is actually a raw potentiometer reading. If it was a raw potentiometer reading it would be converted to a time using the above function.
To do:
The rest of the posts for this project have been arranged by date.
- Write pseudo code for code body
- Write pseudo code for custom functions
- Write pseudo code for setup
- Make notes for special Arduino functions
- Draft code
- Build breadboard circuit
- Compile and test
This isn't a short list but each of those things can be done in less than 30 minutes. Trying to tackle one of those items by itself usually leads to work on the other tasks by proxy. For example, when I made that list as an example I started the To Do list for this project.
Last night I started on the pseudo code with the intent of writing the code body. It turned out the more logical task to start was writing the functions which would translate a potentiometer position into a time and a tea name. Once I compromised with myself that I would sleep after writing those two functions my focus returned and I enjoyed writing the functions. If you look at the pseudo code I've written it's mostly straight code which is not a great practice.
Enough background.
----------
A chart was made which shows which tea name should appear according to which time has been selected. The chart breaks down the six minutes (1-7 minutes) into 24 segments, each 15 seconds long. The name of the tea was written next to the time segment where it displays. Some teas, like Chinese Green only displayed during one 15 second segment while Herbal displayed for the last two minutes. This was intentional since the main focus should be the time.
Chart showing tea names and their associated times
The code was written for the function which will turn a potentiometer reading into a time in whole seconds. These times were from one to seven minutes and went in fifteen second intervals. The idea was that the potentiometer value would be translated into the range of zero to 24. That number would be multiplied by 15. That gives a time value of zero to 360 seconds. After 60 seconds are added the time frame is now 60 seconds to 420 seconds or one to seven minutes. This code could have been written in fewer lines but expanding it to a few lines makes the concept more evident.
Code for translating a potentiometer reading to time
With the chart made earlier the code for the function which takes a time value and converts it to a tea name was made. This works by climbing up a list and checking for a true function. As soon as a time is found which agrees with an IF statement the return function exits this function and sends a string with the tea name back. There was also a check to be sure that the time integer being fed to this function is in the desired range or if the number being received is actually a raw potentiometer reading. If it was a raw potentiometer reading it would be converted to a time using the above function.
Code which returns a tea name
To do:
- Write To Do list
- Write pseudo code for code body
- Write pseudo code for custom functions
- Write pseudo code for setup
- Make notes for special Arduino functions
- Draft code
- Build breadboard circuit
- Compile and test
The rest of the posts for this project have been arranged by date.
A list showing of all the final posts of COMPLETED projects.
Disclaimer for http://24hourengineer.blogspot.com/
This disclaimer must be intact and whole. This disclaimer must be included if a project is distributed.
All information in this blog, or linked by this blog, are not to be taken as advice or solicitation. Anyone attempting to replicate, in whole or in part, is responsible for the outcome and procedure. Any loss of functionality, money, property or similar, is the responsibility of those involved in the replication.
All digital communication regarding the email address 24hourengineer@gmail.com becomes the intellectual property of Brian McEvoy. Any information contained within these messages may be distributed or retained at the discretion of Brian McEvoy. Any email sent to this address, or any email account owned by Brian McEvoy, cannot be used to claim property or assets.
Comments to the blog may be utilized or erased at the discretion of the owner. No one posting may claim claim property or assets based on their post.
This blog, including pictures and text, is copyright to Brian McEvoy.
2015-02-26 (Th)
2015-02-26 (Th)
Comments
Post a Comment