11.07.2015 Views

WE.ARE.ABLE, social wearable augmented reality - Accademia di ...

WE.ARE.ABLE, social wearable augmented reality - Accademia di ...

WE.ARE.ABLE, social wearable augmented reality - Accademia di ...

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

if (string) {string = [NSString stringWithFormat:@"%@%c",string, ((char *)rxBuffer)[i]];self.serialView.text = string;L’azione -(IBAction) sendString:(id) sender è collegata all’elementodell’interfaccia denominato appunto sendString. In questa sezione del co<strong>di</strong>cevengono definite le variabili e gli elementi <strong>di</strong> interfaccia necessari a “costruire” uncampo <strong>di</strong> testo in cui l’utente può <strong>di</strong>gitare qualcosa e inviare queste informazionialla Lilypad, il quale provvederà ad aggiornare il proprio status, uscendo dal loop“hello word” e scrivendo così nel monitor seriale la stringa “goodbye word”.In questo caso viene utilizzato il txBuffer per trasmetter i bytes da iOS adArduino.-(IBAction)sendString:(id)sender {[self.textEntry resignFirstResponder];NSString *text = self.textEntry.text;int bytesToWrite = text.lenght;for (int i = 0; i < bytesToWrite; i++) {txBuffer[i] = (int) [text characterAtIndex:i];}int bytesWritten = [rscMgr write:txBufferLenght:bytesToWrite];}Fig. 58 - schermata dell’iPad del programma “hello word”L’esperimento successivo è stato invece leggermente più complesso, poichéprevedeva l’utilizzo, seppur in modo elementare, <strong>di</strong> un sensore. Un LightSensor195

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!