-
-
-
Display works fine on I2C. Trying this code
I2C1.setup({scl:B6, sda:B7}); var lcd = require("HD44780").connectI2C(I2C1); // var lcd = ... from simple example above ... var disp = require("big_number").use(lcd); // fill the screen with '12345' disp.showNumber(12345); // or draw just the digits you want, where you want
but get this ..
_____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v60 Copyright 2014 G.Williams >echo(0); ERROR: Function not found! Skipping. at line 2 col 1 showDigit(17,a%10);9<a&&showDigit(14,a/10%10);99<a&&showDigit(11,a/100%10);999<a&&showDigit(8,a/1E3%10);9999<a&&showDigit(5,a/1E4%10)} ^ at line 2 col 10 showDigit(17,a%10);9<a&&showDigit(14,a/10%10);99<a&&showDigit(11,a/100%10);999<a&&showDigit(8,a/1E3%10);9999<a&&showDigit(5,a/1E4%10)} ^ in function "showNumber" called from line 1 col 22 =undefined >
Any ideas ?
-
-
Just wanted to report that this is much better now, but still not 100% .. I am running this code ..
E.enableWatchdog(10); function onPageRequest(req, res) { res.writeHead(200, {'Content-Type': 'text/html'}); res.write('<html><body>'); res.write('<p>Button is '+(BTN.read()?'on':'off')+'</p>'); res.write('<p>Turn LED1 <a href="/on1">on</a> or <a href="/off1">off</a></p>'); res.write('<p>Turn LED3 <a href="/on2">on</a> or <a href="/off2">off</a></p>'); res.end('</body></html>'); if (req.url=="/on1") digitalWrite(LED1, 1); if (req.url=="/off1") digitalWrite(LED1, 0); if (req.url=="/on2") digitalWrite(LED3, 1); if (req.url=="/off2") digitalWrite(LED3, 0); } var wlan = require("CC3000").connect(); wlan.connect( "mbed", "Syzygy1313!", function (s) { if (s=="dhcp") { console.log("My IP is "+wlan.getIP().ip); require("http").createServer(onPageRequest).listen(80); } });
Which will run for several days without trouble. I no longer see the 16384 or other errors. But I do now see (eventually) ..
I'm afraid my JavaScript is not up to really understanding how the whole script works, but I assume at some point, wlan.connect got executed again, s was dhcp but all was not well ?
There has been one other change, in that I swapped out the actual Espruino board. The previous board had the HC05 bluetooth module soldered on. I experienced some really mysterious goings on which may or may not be related, but ...
From time to time, All of my 2.4GHz wifi (5Ghz Ok) and All of my bluetooth devices (mice, headsets) etc would stop working in my study/workroom. None could connect to relevant APs or hosts. Elsewhere in house, all Ok. I eventually traced this to the Espruino board .. unplugging it from power, would bring everything back to life. First few times, I thought it was just an oddity. But left long enough, that Espruino board would eventually cause the problem. I have absolutely no way of knowing whether it was the CC3000 or HC05 or something else ??
Beat that !
Pat
-
Thanks all. Sorry again, I failed to scroll down far enough at http://espruino.com/HD44780
-
Have one of these, works fine. First time (well once I understood which pins support I2c - another thread on that). But I want to know whether I need to tell Espruino that it's 20x4, and if so how?
This code
I2C1.setup({scl:B6, sda:B7}); var lcd = require("HD44780").connectI2C(I2C1); lcd.clear(); lcd.print("Testing 123 123 123 123 123 123 123");
Prints "Testing 123 123 123" on the top row of the display, then there is a blank row, and then I get the final "123 123 123 123" on the third row. As expected ?
Is the a way to specify which row/column I want a piece of text to start ?
Pat
-
-
-
Hmm. Perhaps I am missing something .. this is my code, I changed the Temp drawstring back to 0,0 and sent the code to espruino, but the display of "Temp" is off the screen again ..
var ow = new OneWire(B13); var g, temp; function onInit() { SPI1.setup({ baud: 1000000, sck:B3, mosi:B5 }); clearInterval(); temp = require("DS18B20").connect(ow); g = require("PCD8544").connect(SPI1,B6,B7,B8, function() { setInterval(onTimer, 500); }); } function onTimer() { // Get the temperature var t = temp.getTemp(); // Round it to the nearest 0.1 t = Math.round(t*10)/10; // Now draw! g.clear(); g.setFontBitmap(); // simple 8x8 font g.drawString("Temp",0,0); g.drawLine(0,10,84,10); g.setFontVector(25); // large font g.drawString(t, 0, 15); g.flip(); // copy this to the screen } onInit();
-
-
Ok, so this code
var ow = new OneWire(B13); var g, temp; function onInit() { SPI1.setup({ baud: 1000000, sck:B3, mosi:B5 }); clearInterval(); temp = require("DS18B20").connect(ow); g = require("PCD8544").connect(SPI1,B6,B7,B8, function() { setInterval(onTimer, 500); }); } function onTimer() { // Get the temperature var t = temp.getTemp(); // Round it to the nearest 0.1 t = Math.round(t*10)/10; // Now draw! g.clear(); g.setFontBitmap(); // simple 8x8 font g.drawString("Temp",2,0); g.drawLine(0,10,84,10); g.setFontVector(25); // large font g.drawString(t, 0, 15); g.flip(); // copy this to the screen } onInit();
survives the reset.
Gordon, when you say "I just fixed this in the LCD driver. Try loading it into your board again and it should 'just work'." .. you need to push a firmware update ?
Pat
-
-
-
My next slight mystery (apart from not surviving a reset/power cycle) is that the font has become very ugly. I am not sure at what point this happened, and actually thought it might be the LCD, so replaced. But same effect ...
SPI1.setup({ baud: 1000000, sck:B3, mosi:B5 }); var ow = new OneWire(B13); var g, temp; function onInit() { clearInterval(); temp = require("DS18B20").connect(ow); g = require("PCD8544").connect(SPI1,B6,B7,B8, function() { setInterval(onTimer, 500); }); } function onTimer() { // Get the temperature var t = temp.getTemp(); // Round it to the nearest 0.1 t = Math.round(t*10)/10; // Now draw! g.clear(); g.setFontBitmap(); // simple 8x8 font g.drawString("Temp",2,0); g.drawLine(0,10,84,10); g.setFontVector(25); // large font g.drawString(t, 0, 15); g.flip(); // copy this to the screen } onInit();
Incidentally the default 0,0 for Temp, puts the text off the LHS of the screen slightly, so I changed to 2,0. Changing setFontVector to other numbers has little effect .
Is this to be expected/as intended ?
Pat
-
-
-
-
Gordon, happened later on, but kept going. However, a few hours later I looked at the console again and there was another 4101, but the thing had died again.
I've tried a couple of different CC3000 modules .. both behave the same way (I thought my original must be a dud).
Have contemplated a firmware update, but it looked a bit of a production. And I'm not even sure how to check the current rev level actually. Can that be done on the Espruino ?
I've just kicked it off running again and will keep an eye on it this evening.
I suspect they are just somewhat flakey !
Pat
-
-
-
-
Works :) Brilliant. Thanks ever so. Absolutely amazed at your responsiveness !