/* We are going to eavesdrop on the first serial port * and turn on lights via a digital I/O output port , * otherwise we 'd have to send a short message . */ for ( attempts=0; attempts<3; attempts ++) { if ( nb_serial_read ("serial0") == "Knock Knock !") { nb_serial_write ("serial0", "Who 's there ?"); if ( nb_serial_read ("serial0") == " Santa ") { printf (" Hurray !\n"); nb_dio_set ("out1", 1); } } } nb_sms_send ("+123456789", "No presents this year :(")