Close

Starting to upload to GitHub

A project log for Can I borrow a feeling?

or, how I can access a random emotion at the press of a button.

sascha-grantSascha Grant 12/12/2014 at 13:530 Comments

I've just uploaded the excel spreadsheet with the 'Good' and 'Bad' word lists to GitHub. You can find the files for the project here -

https://github.com/ibuildrockets/Borrow_A_Feeling

The first file uploaded is Master_Word_List.xlsx

Since I'm using a 16 x 2 LCD display, I wanted to centre each word. I can probably do this programmatically within the Arduino IDE - but I haven't figured that out yet, so I'm doing it in Excel :)

I need to calculate several things -

To find the length of the word, I'm using the excel formula
=LEN(F2)
since the word is in F2

Lets use the word "excited" as an example. The result of =LEN(F2) would be 7

Next I need to work out how many spaces go before the word. For this, I use the following -

=REPT(" ",((16-J2)/2))
I start by working out how many spaces I need in total - 16 - J2 (length of word)

Using the example "excited" with 7 letters, I will need 9 spaces in total, but only 4.5 spaces before the word, thus the /2 divider. Since you can't have .5, Excel will insert 4 spaces.

Next I need to work out how many spaces to put after the word. I'm using the following to figure that out -

=IF(LEN(E2)*2+LEN(F2)>15,REPT(" ",((16-J2)/2)),REPT(" ",((16-J2)/2)+1))
IF (length of spaces before the word * 2 (so, total spaces) + the word itself is greater than 15, then add the same number of spaces as before. However, if not greater than 15, add the same number of spaces + 1 (so, this will result in 16 characters total)

You'll find the first formula in column E and the 2nd formula in column G

Go, have a play with the excel file - see how changing the lengths of the words affect the numbers of spaces added before and after - but always resulting in 16 characters (unless, of course, you enter a word with more than 16 characters...)

Discussions