Friday, May 3, 2024

ESP32 C3 supermini

 In order for the ESP32 supermini to send data back, need to set the USB CDC on Boot to 'Enable'




 



reference: 


Tuesday, December 26, 2023

BLE on ESP32

 reference: https://forum.arduino.cc/t/startadvertising-is-not-a-member-of-bledevice/1086837/5

So change this part of your sketch:

#include <BLEDevice.h> #include <BLEUtils.h> #include <BLEServer.h> #include <BLE2902.h>

to this:

#include <BLE2902.h> #include <BLEDevice.h> #include <BLEUtils.h> #include <BLEServer.h>



Wednesday, March 22, 2023

PN532 nfc reader on Arduino

  https://how2electronics.com/interfacing-pn532-nfc-rfid-module-with-arduino/

Tested both versions of connection - SPI & IIC which both worked.  Needed to pay attention to comment and uncomment the definition for the nfc:

// Or use this line for a breakout or shield with an I2C connection:

Adafruit_PN532 nfc(PN532_IRQ, PN532_RESET); // seem these IRQ and reset pin assignments doesn't matter of IIC setup

Thursday, March 3, 2022

Reading HEX from SD card and updating the neopixel display

 /*

  the following is modified from SD card file dump


  This sketch shows how to read some data from a file in the SD card using the 

  SD library and update an array of ledMat.


  The circuit:

   SD card attached to SPI bus as follows:

 ** MOSI - pin 11

 ** MISO - pin 12

 ** CLK - pin 13

 ** CS - pin 4 (for MKRZero SD: SDCARD_SS_PIN)


  created  22 December 2010

  by Limor Fried

  modified 9 Apr 2012

  by Tom Igoe

  modified 3 Mar 2022

  by Jeszki

  */

#include <SPI.h>

#include <SD.h>

#include <FastLED.h>


#define DATA_PIN    6

#define LED_TYPE    NEOPIXEL

#define COLOR_ORDER GRB

#define NUM_LEDS    128


CRGB ledMat[NUM_LEDS];

     

const int chipSelect = 4;


void setup() {

  // Open serial communications and wait for port to open:


 FastLED.addLeds<WS2812, DATA_PIN, COLOR_ORDER>(ledMat, NUM_LEDS);


  Serial.begin(9600);

  while (!Serial) {

    ; // wait for serial port to connect. Needed for native USB port only

  }

  Serial.print("Initializing SD card...");

  // see if the card is present and can be initialized:

  if (!SD.begin(chipSelect)) {

    Serial.println("Card failed, or not present");

    // don't do anything more:

    while (1);

  }

  Serial.println("card initialized.");

  // open the file. note that only one file can be open at a time,

  // so you have to close this one before opening another.

  File dataFile = SD.open("test.bin");  //just a text file


  // if the file is available, write to it:

  if (dataFile) {

    int x = 0;

    while (dataFile.available()) {

      char x1 = dataFile.read();

      char x2 = dataFile.read();

      char x3 = dataFile.read();

      Serial.print(x1,HEX);

      Serial.print(x2,HEX);

      Serial.print(x3,HEX);

 if (((x+1)%16)==0) { Serial.println();}     // print 16 char on 1 line

        ledMat[x++]= CRGB(x1,x2,x3);

    }  

    dataFile.close();

  }

  // if the file isn't open, pop up an error:

  else {

    Serial.println("error opening datalog.txt");

  }

   FastLED.show();

   delay(100);

}

void loop() {

}