Advertisement
Guest User

Untitled

a guest
Aug 29th, 2015
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.73 KB | None | 0 0
  1. bitvocer_ino:14: error: no matching function for call to 'BitVoicerSerial::BitVoicerSerial(int)'
  2. C:UsersAnas SanjeevDocumentsArduinolibrariesBitVoicer11/BitVoicer11.h:38: note: candidates are: BitVoicerSerial::BitVoicerSerial()
  3. C:UsersAnas SanjeevDocumentsArduinolibrariesBitVoicer11/BitVoicer11.h:35: note: BitVoicerSerial::BitVoicerSerial(const BitVoicerSerial&)
  4. Exception in thread "Thread-6" java.lang.NullPointerException
  5. at processing.app.syntax.TokenMarker.addToken(TokenMarker.java:299)
  6. at processing.app.syntax.CTokenMarker.doKeyword(CTokenMarker.java:267)
  7. at processing.app.syntax.CTokenMarker.markTokensImpl(CTokenMarker.java:132)
  8. at processing.app.syntax.TokenMarker.markTokens(TokenMarker.java:52)
  9. at processing.app.syntax.JEditTextArea._offsetToX(JEditTextArea.java:550)
  10. at processing.app.syntax.JEditTextArea.scrollTo(JEditTextArea.java:464)
  11. at processing.app.syntax.JEditTextArea.scrollToCaret(JEditTextArea.java:429)
  12. at processing.app.syntax.JEditTextArea.select(JEditTextArea.java:1205)
  13. at processing.app.Editor.statusError(Editor.java:2620)
  14. at processing.app.Editor$DefaultRunHandler.run(Editor.java:1913)
  15. at java.lang.Thread.run(Thread.java:619)
  16.  
  17. //Includes the BitVoicer library to the sketch
  18. #include<BitVoicer11.h>
  19.  
  20. //Sets up the pins and default variables
  21. int pinR = 3;
  22. int pinY = 5;
  23. int pinG = 6;
  24. int blinkDelay = 250;
  25. int sequenceDir = 0;
  26. int lightLevel = 0;
  27.  
  28. //Creates a new instance of the BitVoicerSerial class and
  29. //sets up serial port to 0
  30. BitVoicerSerial bitVoicer = BitVoicerSerial(0);
  31.  
  32. void setup()
  33. {
  34. //Starts serial communication and sets up the pinModes
  35. Serial.begin(9600);
  36. pinMode(pinR, OUTPUT);
  37. pinMode(pinY, OUTPUT);
  38. pinMode(pinG, OUTPUT);
  39. }
  40.  
  41. void loop()
  42. {
  43. //Retrieves data from serial buffer
  44. bitVoicer.getData();
  45.  
  46. //Quits the loop if no string data was returned from getData
  47. if (bitVoicer.strData == "")
  48. {
  49. return;
  50. }
  51.  
  52. //Each of the next 'if' statements performs a different
  53. //task based on the data received from BitVoicer
  54. if (bitVoicer.strData == "wake")
  55. {
  56. digitalWrite(pinR, LOW);
  57. digitalWrite(pinY, LOW);
  58. digitalWrite(pinG, LOW);
  59. digitalWrite(pinR, HIGH);
  60. digitalWrite(pinY, HIGH);
  61. digitalWrite(pinG, HIGH);
  62. delay(200);
  63. digitalWrite(pinR, LOW);
  64. digitalWrite(pinY, LOW);
  65. digitalWrite(pinG, LOW);
  66. delay(200);
  67. digitalWrite(pinR, HIGH);
  68. digitalWrite(pinY, HIGH);
  69. digitalWrite(pinG, HIGH);
  70. delay(200);
  71. digitalWrite(pinR, LOW);
  72. digitalWrite(pinY, LOW);
  73. digitalWrite(pinG, LOW);
  74. delay(200);
  75. digitalWrite(pinR, HIGH);
  76. digitalWrite(pinY, HIGH);
  77. digitalWrite(pinG, HIGH);
  78. delay(200);
  79. digitalWrite(pinR, LOW);
  80. digitalWrite(pinY, LOW);
  81. digitalWrite(pinG, LOW);
  82. bitVoicer.strData = "";
  83. lightLevel = 0;
  84. }
  85. else if (bitVoicer.strData == "sleep")
  86. {
  87. digitalWrite(pinR, LOW);
  88. digitalWrite(pinY, LOW);
  89. digitalWrite(pinG, LOW);
  90. digitalWrite(pinR, HIGH);
  91. digitalWrite(pinY, HIGH);
  92. digitalWrite(pinG, HIGH);
  93. delay(200);
  94. digitalWrite(pinR, LOW);
  95. digitalWrite(pinY, LOW);
  96. digitalWrite(pinG, LOW);
  97. delay(200);
  98. digitalWrite(pinR, HIGH);
  99. digitalWrite(pinY, HIGH);
  100. digitalWrite(pinG, HIGH);
  101. delay(200);
  102. digitalWrite(pinR, LOW);
  103. digitalWrite(pinY, LOW);
  104. digitalWrite(pinG, LOW);
  105. bitVoicer.strData = "";
  106. lightLevel = 0;
  107. }
  108. else if (bitVoicer.strData == "RH")
  109. {
  110. digitalWrite(pinR, HIGH);
  111. bitVoicer.strData = "";
  112. lightLevel = 255;
  113. }
  114. else if (bitVoicer.strData == "RL")
  115. {
  116. digitalWrite(pinR, LOW);
  117. bitVoicer.strData = "";
  118. lightLevel = 0;
  119. }
  120. else if (bitVoicer.strData == "YH")
  121. {
  122. digitalWrite(pinY, HIGH);
  123. bitVoicer.strData = "";
  124. lightLevel = 255;
  125. }
  126. else if (bitVoicer.strData == "YL")
  127. {
  128. digitalWrite(pinY, LOW);
  129. bitVoicer.strData = "";
  130. lightLevel = 0;
  131. }
  132. else if (bitVoicer.strData == "GH")
  133. {
  134. digitalWrite(pinG, HIGH);
  135. bitVoicer.strData = "";
  136. lightLevel = 255;
  137. }
  138. else if (bitVoicer.strData == "GL")
  139. {
  140. digitalWrite(pinG, LOW);
  141. bitVoicer.strData = "";
  142. lightLevel = 0;
  143. }
  144. else if (bitVoicer.strData == "blink")
  145. {
  146. digitalWrite(pinR, HIGH);
  147. digitalWrite(pinY, HIGH);
  148. digitalWrite(pinG, HIGH);
  149. delay(blinkDelay);
  150. digitalWrite(pinR, LOW);
  151. digitalWrite(pinY, LOW);
  152. digitalWrite(pinG, LOW);
  153. delay(blinkDelay);
  154. lightLevel = 255;
  155. }
  156. else if (bitVoicer.strData == "BF")
  157. {
  158. blinkDelay = 100;
  159. bitVoicer.strData = "blink";
  160. lightLevel = 255;
  161. }
  162. else if (bitVoicer.strData == "BFF")
  163. {
  164. switch (blinkDelay)
  165. {
  166. case 500:
  167. blinkDelay = 250;
  168. break;
  169. case 250:
  170. blinkDelay = 100;
  171. break;
  172. default:
  173. break;
  174. }
  175. bitVoicer.strData = "blink";
  176. lightLevel = 255;
  177. }
  178. else if (bitVoicer.strData == "BS")
  179. {
  180. blinkDelay = 500;
  181. bitVoicer.strData = "blink";
  182. lightLevel = 255;
  183. }
  184. else if (bitVoicer.strData == "BSS")
  185. {
  186. switch (blinkDelay)
  187. {
  188. case 100:
  189. blinkDelay = 250;
  190. break;
  191. case 250:
  192. blinkDelay = 500;
  193. break;
  194. default:
  195. break;
  196. }
  197. bitVoicer.strData = "blink";
  198. lightLevel = 255;
  199. }
  200. else if (bitVoicer.strData == "sequence")
  201. {
  202. if (sequenceDir == 0)
  203. {
  204. digitalWrite(pinR, HIGH);
  205. delay(250);
  206. digitalWrite(pinR, LOW);
  207. digitalWrite(pinY, HIGH);
  208. delay(250);
  209. digitalWrite(pinY, LOW);
  210. digitalWrite(pinG, HIGH);
  211. delay(250);
  212. digitalWrite(pinG, LOW);
  213. }
  214. else
  215. {
  216. digitalWrite(pinG, HIGH);
  217. delay(250);
  218. digitalWrite(pinG, LOW);
  219. digitalWrite(pinY, HIGH);
  220. delay(250);
  221. digitalWrite(pinY, LOW);
  222. digitalWrite(pinR, HIGH);
  223. delay(250);
  224. digitalWrite(pinR, LOW);
  225. }
  226. lightLevel = 255;
  227. }
  228. else if (bitVoicer.strData == "revert")
  229. {
  230. if (sequenceDir == 0)
  231. {
  232. sequenceDir = 1;
  233. }
  234. else
  235. {
  236. sequenceDir = 0;
  237. }
  238. bitVoicer.strData = "sequence";
  239. lightLevel = 255;
  240. }
  241. else if (bitVoicer.strData == "ALLON")
  242. {
  243. digitalWrite(pinR, HIGH);
  244. digitalWrite(pinY, HIGH);
  245. digitalWrite(pinG, HIGH);
  246. bitVoicer.strData = "";
  247. lightLevel = 255;
  248. }
  249. else if (bitVoicer.strData == "ALLOFF")
  250. {
  251. digitalWrite(pinR, LOW);
  252. digitalWrite(pinY, LOW);
  253. digitalWrite(pinG, LOW);
  254. bitVoicer.strData = "";
  255. lightLevel = 0;
  256. }
  257. else if (bitVoicer.strData == "brighter")
  258. {
  259. if (lightLevel < 255)
  260. {
  261. lightLevel += 85;
  262. analogWrite(pinR, lightLevel);
  263. analogWrite(pinY, lightLevel);
  264. analogWrite(pinG, lightLevel);
  265. }
  266. bitVoicer.strData = "";
  267. }
  268. else if (bitVoicer.strData == "darker")
  269. {
  270. if (lightLevel > 0)
  271. {
  272. lightLevel -= 85;
  273. analogWrite(pinR, lightLevel);
  274. analogWrite(pinY, lightLevel);
  275. analogWrite(pinG, lightLevel);
  276. }
  277. bitVoicer.strData = "";
  278. }
  279. else
  280. {
  281. Serial.println("ERROR:" + bitVoicer.strData);
  282. bitVoicer.strData = "";
  283. }
  284. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement