Jak

Recent activity

Started Strange compilation problem

I tried to access NocanMessage member "dlen" in my program because that is what I saw in github in nocan_ll.h. The compiler said 'no member "dlen" in struct NocanMessage'. I was puzzled for a while thinking there was some strange visibility issue. I finally tried to access data_len, because this seemed to fit your pattern of naming. The compiler liked it. I'm thinking that the zip of your library does not match the checked in source code. Was data_len ever called dlen?

I'm still figuring out "best practices" and coding style on Arduino. Normally, I'd prefer accessors for internal data fields. I suppose it is a waste of memory on a small processor.

Thanks,
-jak

Posted in Multiple displays in network

Alain,

It took me a while to get time and all the parts. I have successfully connected a CANZERO to an Adafruit RA8875 driver board (https://www.adafruit.com/product/1590) and a 7 inch TFT display (https://www.adafruit.com/product/2354).

I have included the Pin connections and a short sketch in case anyone else wants to try this. I should put the sketch in github somewhere, but have not.

Thanks for your advice.

-jak

//
// Demo sketch connecting a CANZERO to Adafruit RA8875 graphics driver board connected to a 7 inch 800x480 TFT display
//
// Warning, there is no error handling….
//
// jak.mang
// 02/17/19

#include #include #include

// Pin Out RA8875 -> CANZERO
// Vin: +5V
// GND: GND
// 3Vo: not connected (or use for the SPI fix circuit described in wiki)
// Lite: not connected
// SCK: SPI SCK
// MISO: SPI MISO (remember that it's not tristate! see SPI fix circuit if you want add some SPI device)
// MOSI: SPI MOSI
// CS: SPI CS Used Pin 7
// RST: Any MCU Pin or 10K resistor tied to 3V3 used Pin 6
// WAIT: Not used
// INT: Any MCU pin used Pin 2

#define RA8875_INT 2 //any pin
#define RA8875_CS 7 //any pin
#define RA8875_RST 6 //any pin

Adafruit_RA8875 tft = Adafruit_RA8875(RA8875_CS,RA8875_RST);

void setup() {

NocanChannelId cid;

if (tft.begin(RA8875_800x480)) {
tft.displayOn(true);
tft.GPIOX(true); // Enable TFT - display enable tied to GPIOX
tft.PWM1config(true, RA8875_PWM_CLK_DIV1024); // PWM output for backlight
tft.PWM1out(255);

  tft.fillScreen(RA8875_BLACK);
  tft.fillScreen(RA8875_WHITE);   }

Nocan.open();
Nocan.registerChannel("display", &cid);
Nocan.subscribeChannel(cid);
pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {

NocanMessage msg;

Nocan.receiveMessage(&msg);

if (msg.data[0] == 'o') {
// Turn on LED
digitalWrite(LED_BUILTIN, HIGH);
// Turn screen black
tft.fillScreen(RA8875_BLACK);
}
else if (msg.data[0] == 'x') {
// Turn off LED
digitalWrite(LED_BUILTIN, LOW);
// Turn screen white
tft.fillScreen(RA8875_WHITE);
}
}

Started Multiple displays in network

I have a project where I would like multiple displays in addition to sensors. The question is the best way to do this.
1 add a display to nocan
2 interface a pi zero to nocan
3 run a pi master as a slave

I’m not an arduino expert, but it looks like a mkrZero is not designed for a display. Am I correct? Any suggestions on options 2 or 3?

Thanks
-jak