Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BeautifulMemeProject by
pic.cpp
00001 /* University of York Robotics Laboratory PsiSwarm Library: PIC and Audio Driver Source File 00002 * 00003 * File: pic.cpp 00004 * 00005 * (C) Dept. Electronics & Computer Science, University of York 00006 * James Hilder, Alan Millard, Homero Elizondo, Jon Timmis 00007 * 00008 * PsiSwarm Library Version: 0.3 00009 * 00010 * October 2015 00011 * 00012 */ 00013 00014 00015 #include "psiswarm.h" 00016 00017 00018 void play_audio_string(char * tune){ 00019 char length = strlen(tune); 00020 play_tune(tune,length); 00021 } 00022 00023 void play_tune(char * tune, char length){ 00024 char to_send [length+3]; 00025 char start_array[2]; 00026 start_array [0] = 'S'; 00027 start_array [1] = length; 00028 strcpy(to_send,start_array); 00029 strncat(to_send,tune,length); 00030 debug(to_send); 00031 primary_i2c.write(PIC_ADDRESS,to_send,length+2,false); 00032 } 00033 00034 00035 char IF_check_pic_firmware(){ 00036 char buffer[6]; 00037 buffer[0] = 0; 00038 primary_i2c.write(PIC_ADDRESS,"I",1,false); 00039 wait(0.1); 00040 primary_i2c.read(PIC_ADDRESS,buffer,6); 00041 debug(buffer); 00042 if(buffer[0] != 'F' || buffer[1] != 'W'){ 00043 debug("WARNING: Cannot read information from PIC microcontroller"); 00044 return 1; 00045 } 00046 debug(buffer); 00047 return 0; 00048 }
Generated on Fri Jul 15 2022 08:26:10 by
 1.7.2
 1.7.2 
    