:::: MENU ::::

Puck.JS 사용법

FEATURES

  • Bluetooth Low Energy
  • Espruino JavaScript interpreter pre-installed
  • nRF52832 SoC – 64MHz Cortex M4, 64kB RAM, 512kB Flash
  • 8 x 0.1″ GPIO (capable of PWM, SPI, I2C, UART, Analog Input)
  • 9 x SMD GPIO (capable of PWM, SPI, I2C, UART)
  • ABS plastic rear case with lanyard mount
  • Silicone cover with tactile button
  • MAG3110 Magnetometer
  • IR Transmitter
  • Built in thermometer, light and battery level sensors
  • Red, Green and Blue LEDs
  • NFC tag programmable from JavaScript
  • Pin capable of capacitive sensing
  • Weight: 14g in plastic case, 20g in packaging
  • Dimensions of cardboard box: 64mm x 62mm x 16mm
  • Dimensions of plastic case: 36mm dia, 12.5mm thick
  • Dimensions of bare PCB: 29mm dia, 9mm thick

회로도 및 PCB Layout Eagle File

ON-BOARD LEDS, BUTTON AND GPIO

LEDs

  • Red LED on: digitalWrite(LED1,1), Off: digitalWrite(LED1,0)
  • LED2 : green, LED3: blue
  • LED1.write(1) or  LED1.write(0)
  • LED1.set(), LED1.reset()
  • 3개의 LED 한꺼번에 제어 digitalWrite([LED3,LED2,LED1], 7)

Button

  • digitalRead(BTN) or BTN.read()
  • 버튼 상태를 Polling 하는 것은 power 소모가 심하므로, setWatch 함수를 사용해서 버튼 상태가 바뀌는 것을 체크함.

    setWatch(function() { console.log(“Pressed”);}, BTN, {edge:”rising”, debounce:50, repeat:true});

GPIO pins

  • GPIO 핀은 D0 부터 D31까지.  digitalWrite/digitalRead 커맨드를 사용할 수 있고 PWM, I2C, SPI and Analog 사용 가능

ON-BOARD PERIPHERALS

  • Magnetometer
  • IR / Infrared
  • NFC – Near Field Communications
  • Light sensor
  • Bluetooth
  • Temperature
  • Battery level
  • Capacitive sense
  • SERIAL CONSOLE

FIRMWARE UPDATES

via nRF Toolbox App (Android & iOS)

  • On your Bluetooth LE capable phone, install the nRF Toolbox app
  • Download the latest espruino_xxx_puckjs.zip file from the binaries folder
  • Reset Puck.js with the button held down – the Green LED should be lit
  • Release the button within 3 seconds of inserting the battery – the Red LED should light instead. If it doesn’t, you’ll need to try again, holding the button down for less time after inserting the battery.
  • Open the nRF Toolbox app
  • Tap the DFU icon
  • Tap Select File, choose Distribution Packet (ZIP), and choose the ZIP file you downloaded
  • Tap Select Device and choose the device called DfuTarg
  • Now tap Upload and wait. The LED should turn blue and the DFU process will start – it will take around 90 seconds to complete

Espruino IDE 사용하기

  • Web Bluetooth 사용 설정: Mac에서 BLE가 지원되는지 확인하는 법은 “이 Mac에 관하여” > 시스템 리포트 > 하드웨어 > Bluetooth 항목아래 ” Bluetooth 저에너지 기술이 지원됨” 이 “예”라고 표시되어 있는지 확인한다.
  • 크롬에서 주소표시줄에 chrome://flags를 입력하고, ” #enable-web-bluetooth” 항목을 사용하도록 설정하고 브라우저를 다시 시작함.
  • https://www.espruino.com/ide/ 에서 Web IDE를 시작한다.
  • Web IDE에서 연결 버튼을 클릭하고, Port설정에서 Web Bluetooth를 선택한다.

참고: https://www.espruino.com/Puck.js+Quick+Start


So, what do you think ?