Advertisement
Guest User

dupa-dupa

a guest
Dec 19th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Erlang 0.91 KB | None | 0 0
  1. -module(device).
  2. -compile([export_all]).
  3. print({gotoxy,X,Y}) ->
  4.    io:format("\e[~p;~pH",[Y,X]);
  5. print({printxy,X,Y,Msg}) ->
  6.    io:format("\e[~p;~pH~p",[Y,X,Msg]);
  7. print({clear}) ->
  8.    io:format("\e[2J",[]);
  9. print({tlo}) ->
  10.   print({printxy,2,4,1.2343}),
  11.   io:format("",[])  .
  12.  
  13. printxy({X,Y,Msg}) ->
  14.    io:format("\e[~p;~pH~p~n",[Y,X,Msg]).
  15.  
  16. formatTime({HH,Mm,Ss})->
  17.     integer_to_list(HH)++":"++integer_to_list(Mm)++":"++integer_to_list(Ss).
  18.  
  19. formatTemperature({Value})->
  20.   integer_to_list(Value)++" C".
  21.  
  22. formatSeason(spring)->
  23.   "Spring";
  24. formatSeason(summery)->
  25.   "Summer";
  26. formatSeason(autumn)->
  27.   "Autumn";
  28. formatSeason(winter)->
  29.   "Winter".
  30.  
  31.  
  32. display({TimeX,TimeY,TWidth},{SeasonX,SeasonY,SWidth},{TemperatureX,TemperatureY,TempWidth})->
  33.   .
  34.  
  35.  
  36. main()->
  37.   print({clear}),
  38.   TimeFormat = formatTime({17,30,00}),
  39.   printxy({50,20,TimeFormat}),
  40.   printxy({50,21,formatTime({18,30,00})}).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement