Components and supplies
Speaker: 3W, 4 ohms
Real Time Clock (RTC)
Jumper wires (generic)
Arduino UNO
Project description
Code
talking clock
arduino
1#include <SPI.h> 2 3#include <Wire.h> 4#include "RTClib.h" 5#include 6 "Talkie.h" 7#include "Vocab_US_Large.h" 8 9RTC_DS1307 rtc; 10Talkie voice; 11 12 13 14 15void 16 setup() { 17 // put your setup code here, to run once: 18 19 20 Serial.begin(9600); 21 22 if (! rtc.begin()) { 23 Serial.println("Couldn't find RTC"); 24 while 25 (1); 26 } 27 28 if (! rtc.isrunning()) { 29 Serial.println("RTC is NOT 30 running!"); 31 // following line sets the RTC to the date & time this sketch 32 was compiled 33 rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); 34 35 } 36} 37 38void 39 loop() { 40 DateTime now = rtc.now(); 41 int v=0; 42 int h=now.hour(); 43 44 int m=now.minute(); 45 int s=now.second(); 46 47 if (h>11){ 48 v=1; 49 50 } 51 if (h>12) { 52 h=h-12; 53 } 54 55 Serial.print(h); 56 57 58 59 Serial.print(":"); 60 Serial.print(m); 61 Serial.print(":"); 62 Serial.print(s); 63 64 Serial.println(); 65 66 67 voice.say(sp3_THE); 68 voice.say(sp3_TIME); 69 70 voice.say(sp3_IS); 71 72 if (h==1){ 73 voice.say(sp3_ONE); 74 } 75 76 if (h==2){ 77 voice.say(sp3_TWO); 78 } 79 if (h==3){ 80 voice.say(sp3_THREE); 81 82 } 83 if (h==4){ 84 voice.say(sp3_FOUR); 85 } 86 if (h==5){ 87 voice.say(sp3_FIVE); 88 89 } 90 if (h==6){ 91 voice.say(sp3_SIX); 92 } 93 if (h==7){ 94 voice.say(sp3_SEVEN); 95 96 } 97 if (h==8){ 98 voice.say(sp3_EIGHT); 99 } 100 if (h==9){ 101 102 voice.say(sp3_NINE); 103 } 104 if (h==10){ 105 voice.say(sp3_TEN); 106 107 } 108 if (h==11){ 109 voice.say(sp3_ELEVEN); 110 } 111 if (h==12){ 112 113 voice.say(sp3_TWELVE); 114 } 115 if (m==0){ 116 voice.say (sp3_OCLOCK); 117} 118if 119 (m==1){ 120 voice.say (sp3_ZERO); 121 voice.say (sp3_ONE); 122} 123if (m==2){ 124 125 voice.say (sp3_ZERO); 126 voice.say (sp3_TWO); 127} 128if (m==3){ 129 voice.say 130 (sp3_ZERO); 131 voice.say (sp3_THREE); 132} 133if (m==4){ 134 voice.say (sp3_ZERO); 135 136 voice.say (sp3_FOUR); 137} 138if (m==5){ 139 voice.say (sp3_ZERO); 140 voice.say 141 (sp3_FIVE); 142} 143if (m==6){ 144 voice.say (sp3_ZERO); 145 voice.say (sp3_SIX); 146} 147if 148 (m==7){ 149 voice.say (sp3_ZERO); 150 voice.say (sp3_SEVEN); 151} 152if (m==8){ 153 154 voice.say (sp3_ZERO); 155 voice.say (sp3_EIGHT); 156} 157if (m==9){ 158 voice.say 159 (sp3_ZERO); 160 voice.say (sp3_NINE); 161} 162if (m==10){ 163 164 voice.say (sp3_TEN); 165} 166if 167 (m==11){ 168 169 voice.say (sp3_ELEVEN); 170} 171if (m==12){ 172 173 voice.say 174 (sp3_TWELVE); 175} 176if (m==13){ 177 178 voice.say (sp3_THIRTEEN); 179} 180if 181 (m==14){ 182 183 voice.say (sp3_FOURTEEN); 184} 185if (m==15){ 186 187 voice.say 188 (sp3_FIFTEEN); 189} 190if (m==16){ 191 192 voice.say (sp3_SIXTEEN); 193} 194if 195 (m==17){ 196 197 voice.say (sp3_SEVENTEEN); 198} 199if (m==18){ 200 201 voice.say 202 (sp3_EIGHTEEN); 203} 204if (m==19){ 205 206 voice.say (sp3_NINETEEN); 207} 208if 209 (m==20){ 210 211 voice.say (sp3_TWENTY); 212} 213 214if (m==21){ 215 voice.say 216 (sp3_TWENTY); 217 voice.say (sp3_ONE); 218} 219if (m==22){ 220 voice.say (sp3_TWENTY); 221 222 voice.say (sp3_TWO); 223} 224if (m==23){ 225 voice.say (sp3_TWENTY); 226 voice.say 227 (sp3_THREE); 228} 229if (m==24){ 230 voice.say (sp3_TWENTY); 231 voice.say (sp3_FOUR); 232} 233if 234 (m==25){ 235 voice.say (sp3_TWENTY); 236 voice.say (sp3_FIVE); 237} 238if (m==26){ 239 240 voice.say (sp3_TWENTY); 241 voice.say (sp3_SIX); 242} 243if (m==27){ 244 voice.say 245 (sp3_TWENTY); 246 voice.say (sp3_SEVEN); 247} 248if (m==28){ 249 voice.say (sp3_TWENTY); 250 251 voice.say (sp3_EIGHT); 252} 253if (m==29){ 254 voice.say (sp3_TWENTY); 255 256 voice.say (sp3_NINE); 257} 258if (m==30){ 259 260 voice.say (sp3_THIRTY); 261} 262 263if 264 (m==31){ 265 voice.say (sp3_THIRTY); 266 voice.say (sp3_ONE); 267} 268if (m==32){ 269 270 voice.say (sp3_THIRTY); 271 voice.say (sp3_TWO); 272} 273if (m==33){ 274 voice.say 275 (sp3_THIRTY); 276 voice.say (sp3_THREE); 277} 278if (m==34){ 279 voice.say (sp3_THIRTY); 280 281 voice.say (sp3_FOUR); 282} 283if (m==35){ 284 voice.say (sp3_THIRTY); 285 voice.say 286 (sp3_FIVE); 287} 288if (m==36){ 289 voice.say (sp3_THIRTY); 290 voice.say (sp3_SIX); 291} 292if 293 (m==37){ 294 voice.say (sp3_THIRTY); 295 voice.say (sp3_SEVEN); 296} 297if (m==38){ 298 299 voice.say (sp3_THIRTY); 300 voice.say (sp3_EIGHT); 301} 302if (m==39){ 303 304 voice.say (sp3_THIRTY); 305 voice.say (sp3_NINE); 306} 307if (m==40){ 308 309 310 voice.say (sp3_FOURTY); 311} 312 313if (m==41){ 314 voice.say (sp3_FOURTY); 315 316 voice.say (sp3_ONE); 317} 318if (m==42){ 319 voice.say (sp3_FOURTY); 320 voice.say 321 (sp3_TWO); 322} 323if (m==43){ 324 voice.say (sp3_FOURTY); 325 voice.say (sp3_THREE); 326} 327if 328 (m==44){ 329 voice.say (sp3_FOURTY); 330 voice.say (sp3_FOUR); 331} 332if (m==45){ 333 334 voice.say (sp3_FOURTY); 335 voice.say (sp3_FIVE); 336} 337if (m==46){ 338 voice.say 339 (sp3_FOURTY); 340 voice.say (sp3_SIX); 341} 342if (m==47){ 343 voice.say (sp3_FOURTY); 344 345 voice.say (sp3_SEVEN); 346} 347if (m==48){ 348 voice.say (sp3_FOURTY); 349 350 voice.say (sp3_EIGHT); 351} 352if (m==49){ 353 voice.say (sp3_FOURTY); 354 voice.say 355 (sp3_NINE); 356} 357if (m==50){ 358 359 voice.say (sp3_FIFTY); 360} 361 362if 363 (m==51){ 364 voice.say (sp3_FIFTY); 365 voice.say (sp3_ONE); 366} 367if (m==52){ 368 369 voice.say (sp3_FIFTY); 370 voice.say (sp3_TWO); 371} 372if (m==53){ 373 voice.say 374 (sp3_FIFTY); 375 voice.say (sp3_THREE); 376} 377if (m==54){ 378 voice.say (sp3_FIFTY); 379 380 voice.say (sp3_FOUR); 381} 382if (m==55){ 383 voice.say (sp3_FIFTY); 384 voice.say 385 (sp3_FIVE); 386} 387if (m==56){ 388 voice.say (sp3_FIFTY); 389 voice.say (sp3_SIX); 390} 391if 392 (m==57){ 393 voice.say (sp3_FIFTY); 394 voice.say (sp3_SEVEN); 395} 396if (m==58){ 397 398 voice.say (sp3_FIFTY); 399 voice.say (sp3_EIGHT); 400} 401if (m==59){ 402 voice.say 403 (sp3_FIFTY); 404 voice.say (sp3_NINE); 405} 406if (v==0){ 407 voice.say (sp3_A_M); 408 409} 410if (v==1){ 411 voice.say(sp3_P_M); 412} 413 delay (60000); 414}
talking clock
arduino
1#include <SPI.h> 2 3#include <Wire.h> 4#include "RTClib.h" 5#include "Talkie.h" 6#include "Vocab_US_Large.h" 7 8RTC_DS1307 rtc; 9Talkie voice; 10 11 12 13 14void setup() { 15 // put your setup code here, to run once: 16 17 18 Serial.begin(9600); 19 if (! rtc.begin()) { 20 Serial.println("Couldn't find RTC"); 21 while (1); 22 } 23 24 if (! rtc.isrunning()) { 25 Serial.println("RTC is NOT running!"); 26 // following line sets the RTC to the date & time this sketch was compiled 27 rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); 28 29 } 30} 31 32void loop() { 33 DateTime now = rtc.now(); 34 int v=0; 35 int h=now.hour(); 36 int m=now.minute(); 37 int s=now.second(); 38 39 if (h>11){ 40 v=1; 41 } 42 if (h>12) { 43 h=h-12; 44 } 45 46 Serial.print(h); 47 48 49 Serial.print(":"); 50 Serial.print(m); 51 Serial.print(":"); 52 Serial.print(s); 53 Serial.println(); 54 55 56 voice.say(sp3_THE); 57 voice.say(sp3_TIME); 58 voice.say(sp3_IS); 59 60 if (h==1){ 61 voice.say(sp3_ONE); 62 } 63 if (h==2){ 64 voice.say(sp3_TWO); 65 } 66 if (h==3){ 67 voice.say(sp3_THREE); 68 } 69 if (h==4){ 70 voice.say(sp3_FOUR); 71 } 72 if (h==5){ 73 voice.say(sp3_FIVE); 74 } 75 if (h==6){ 76 voice.say(sp3_SIX); 77 } 78 if (h==7){ 79 voice.say(sp3_SEVEN); 80 } 81 if (h==8){ 82 voice.say(sp3_EIGHT); 83 } 84 if (h==9){ 85 voice.say(sp3_NINE); 86 } 87 if (h==10){ 88 voice.say(sp3_TEN); 89 } 90 if (h==11){ 91 voice.say(sp3_ELEVEN); 92 } 93 if (h==12){ 94 voice.say(sp3_TWELVE); 95 } 96 if (m==0){ 97 voice.say (sp3_OCLOCK); 98} 99if (m==1){ 100 voice.say (sp3_ZERO); 101 voice.say (sp3_ONE); 102} 103if (m==2){ 104 voice.say (sp3_ZERO); 105 voice.say (sp3_TWO); 106} 107if (m==3){ 108 voice.say (sp3_ZERO); 109 voice.say (sp3_THREE); 110} 111if (m==4){ 112 voice.say (sp3_ZERO); 113 voice.say (sp3_FOUR); 114} 115if (m==5){ 116 voice.say (sp3_ZERO); 117 voice.say (sp3_FIVE); 118} 119if (m==6){ 120 voice.say (sp3_ZERO); 121 voice.say (sp3_SIX); 122} 123if (m==7){ 124 voice.say (sp3_ZERO); 125 voice.say (sp3_SEVEN); 126} 127if (m==8){ 128 voice.say (sp3_ZERO); 129 voice.say (sp3_EIGHT); 130} 131if (m==9){ 132 voice.say (sp3_ZERO); 133 voice.say (sp3_NINE); 134} 135if (m==10){ 136 137 voice.say (sp3_TEN); 138} 139if (m==11){ 140 141 voice.say (sp3_ELEVEN); 142} 143if (m==12){ 144 145 voice.say (sp3_TWELVE); 146} 147if (m==13){ 148 149 voice.say (sp3_THIRTEEN); 150} 151if (m==14){ 152 153 voice.say (sp3_FOURTEEN); 154} 155if (m==15){ 156 157 voice.say (sp3_FIFTEEN); 158} 159if (m==16){ 160 161 voice.say (sp3_SIXTEEN); 162} 163if (m==17){ 164 165 voice.say (sp3_SEVENTEEN); 166} 167if (m==18){ 168 169 voice.say (sp3_EIGHTEEN); 170} 171if (m==19){ 172 173 voice.say (sp3_NINETEEN); 174} 175if (m==20){ 176 177 voice.say (sp3_TWENTY); 178} 179 180if (m==21){ 181 voice.say (sp3_TWENTY); 182 voice.say (sp3_ONE); 183} 184if (m==22){ 185 voice.say (sp3_TWENTY); 186 voice.say (sp3_TWO); 187} 188if (m==23){ 189 voice.say (sp3_TWENTY); 190 voice.say (sp3_THREE); 191} 192if (m==24){ 193 voice.say (sp3_TWENTY); 194 voice.say (sp3_FOUR); 195} 196if (m==25){ 197 voice.say (sp3_TWENTY); 198 voice.say (sp3_FIVE); 199} 200if (m==26){ 201 voice.say (sp3_TWENTY); 202 voice.say (sp3_SIX); 203} 204if (m==27){ 205 voice.say (sp3_TWENTY); 206 voice.say (sp3_SEVEN); 207} 208if (m==28){ 209 voice.say (sp3_TWENTY); 210 voice.say (sp3_EIGHT); 211} 212if (m==29){ 213 voice.say (sp3_TWENTY); 214 voice.say (sp3_NINE); 215} 216if (m==30){ 217 218 voice.say (sp3_THIRTY); 219} 220 221if (m==31){ 222 voice.say (sp3_THIRTY); 223 voice.say (sp3_ONE); 224} 225if (m==32){ 226 voice.say (sp3_THIRTY); 227 voice.say (sp3_TWO); 228} 229if (m==33){ 230 voice.say (sp3_THIRTY); 231 voice.say (sp3_THREE); 232} 233if (m==34){ 234 voice.say (sp3_THIRTY); 235 voice.say (sp3_FOUR); 236} 237if (m==35){ 238 voice.say (sp3_THIRTY); 239 voice.say (sp3_FIVE); 240} 241if (m==36){ 242 voice.say (sp3_THIRTY); 243 voice.say (sp3_SIX); 244} 245if (m==37){ 246 voice.say (sp3_THIRTY); 247 voice.say (sp3_SEVEN); 248} 249if (m==38){ 250 voice.say (sp3_THIRTY); 251 voice.say (sp3_EIGHT); 252} 253if (m==39){ 254 voice.say (sp3_THIRTY); 255 voice.say (sp3_NINE); 256} 257if (m==40){ 258 259 voice.say (sp3_FOURTY); 260} 261 262if (m==41){ 263 voice.say (sp3_FOURTY); 264 voice.say (sp3_ONE); 265} 266if (m==42){ 267 voice.say (sp3_FOURTY); 268 voice.say (sp3_TWO); 269} 270if (m==43){ 271 voice.say (sp3_FOURTY); 272 voice.say (sp3_THREE); 273} 274if (m==44){ 275 voice.say (sp3_FOURTY); 276 voice.say (sp3_FOUR); 277} 278if (m==45){ 279 voice.say (sp3_FOURTY); 280 voice.say (sp3_FIVE); 281} 282if (m==46){ 283 voice.say (sp3_FOURTY); 284 voice.say (sp3_SIX); 285} 286if (m==47){ 287 voice.say (sp3_FOURTY); 288 voice.say (sp3_SEVEN); 289} 290if (m==48){ 291 voice.say (sp3_FOURTY); 292 voice.say (sp3_EIGHT); 293} 294if (m==49){ 295 voice.say (sp3_FOURTY); 296 voice.say (sp3_NINE); 297} 298if (m==50){ 299 300 voice.say (sp3_FIFTY); 301} 302 303if (m==51){ 304 voice.say (sp3_FIFTY); 305 voice.say (sp3_ONE); 306} 307if (m==52){ 308 voice.say (sp3_FIFTY); 309 voice.say (sp3_TWO); 310} 311if (m==53){ 312 voice.say (sp3_FIFTY); 313 voice.say (sp3_THREE); 314} 315if (m==54){ 316 voice.say (sp3_FIFTY); 317 voice.say (sp3_FOUR); 318} 319if (m==55){ 320 voice.say (sp3_FIFTY); 321 voice.say (sp3_FIVE); 322} 323if (m==56){ 324 voice.say (sp3_FIFTY); 325 voice.say (sp3_SIX); 326} 327if (m==57){ 328 voice.say (sp3_FIFTY); 329 voice.say (sp3_SEVEN); 330} 331if (m==58){ 332 voice.say (sp3_FIFTY); 333 voice.say (sp3_EIGHT); 334} 335if (m==59){ 336 voice.say (sp3_FIFTY); 337 voice.say (sp3_NINE); 338} 339if (v==0){ 340 voice.say (sp3_A_M); 341} 342if (v==1){ 343 voice.say(sp3_P_M); 344} 345 delay (60000); 346}
Downloadable files
simple talking clock
simple talking clock
Comments
Only logged in users can leave comments
garysat
0 Followers
•0 Projects
Table of contents
Intro
9
0