Sha256: e5ceed80a93c142e6ab0e72b8a4e5822c90492421cd290dd14cf70c92a40cd30
Contents?: true
Size: 799 Bytes
Versions: 8
Compression:
Stored size: 799 Bytes
Contents
# # Example showing how to load, modify and save the board's EEPROM. # require 'bundler/setup' require 'denko' board = Denko::Board.new(Denko::Connection::Serial.new) # Initialization automatically gets all EEPROM data from the board. # eeprom = Denko::EEPROM::BuiltIn(board: board) eeprom = board.eeprom # EEPROM size reported by the board. puts "EEPROM Size: #{eeprom.length} bytes" # Write values like an array. eeprom[0] = 128 eeprom[1] = 127 # Changes do not save to the board automatically. # Call #save to write to the board, and automatically reload from it. eeprom.save # Read values like an array. puts "Address 0 contains: #{eeprom[0]}" # Enumerate like an array. eeprom.each_with_index do |byte, address| if address == 1 puts "Address #{address} contains #{byte}" end end
Version data entries
8 entries across 8 versions & 1 rubygems