Wednesday 29 October 2014

Processing

Digital Clock 


Over the weekend I extended onto a previous piece of work (see blog post 24/10/14) the basic premise of how a digital clock would work in processing. This was completed using "strings". Strings are defined as a sequence of characters. These characters can be coded in such a way that a certain character, i.e. 1, 2, 3, etc, would appear every second or amount of time that has been specified. To achieve this I created values such as second, minute, hour and organised them as ca be seen below. 

  String[]snowden={"S","N","O","W","D","E","N"};
  String ye=str(year());
  String mo=str(month());
  String d=str(day());
  String h=str(hour());
  String m=str(minute());
  String s=str(second());  
  String time=ye+"/"+mo+"/"+d+" "+h+":"+m+":"+s;

What this does is it determines what order the characters shall be displayed in. The bottom string determines this and the inclusions of characters such as "/" and ":", mean that it will be displayed professionally like 29/10/14 11:20:30. The below image shows this. 


One issue that this does seem to have however is that the previous number does take some time to fade out, which does leave the second part to become quite unreadable. This is something that I am going to have to look at and change because the whole part of this is clock is that you can garner information from it, and if it is not able to be read then the whole thing is slightly pointless. 



No comments:

Post a Comment