This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <avr/io.h> | |
#include <util/delay.h> | |
extern "C" { | |
#include "USART.h" | |
} | |
#include "mySPI.h" | |
#include "EEPROM25_256.h" | |
int main(){ | |
initUSART(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <avr/io.h> | |
#include "mySPI.h" | |
#include "EEPROM25_256.h" | |
uint8_t EEPROM25_256::isLastElement(uint16_t currentIndex, uint16_t numOfElements){ | |
return (currentIndex == numOfElements - 1); | |
} | |
uint8_t EEPROM25_256::isfirstAddressOfPage(uint16_t address){ | |
return address % BYTES_PER_PAGE == 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <avr/io.h> | |
#include <util/delay.h> | |
extern "C" { | |
#include "USART.h" | |
} | |
#include "mySPI.h" | |
#include "MAX31855.h" | |
int main(){ | |
initUSART(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <avr/io.h> | |
#include "MAX31855.h" | |
#include "mySPI.h" | |
void MAX31855::getData(){ | |
selectSlave(_port, _pin); | |
tradeByte(0); hi16bits = SPDR << 8; | |
tradeByte(0); hi16bits |= SPDR ; | |
tradeByte(0); lo16bits = SPDR << 8; | |
tradeByte(0); lo16bits |= SPDR ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <avr/io.h> | |
#include "mySPI.h" | |
void selectSlave(uint8_t port, uint8_t pin){ | |
switch(port){ | |
case 'B': PORTB &= ~(1 << pin); break; | |
case 'C': PORTC &= ~(1 << pin); break; | |
case 'D': PORTD &= ~(1 << pin); break; | |
default : PORTB &= ~(1 << PB2); break; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103AT | |
温度(℃) 抵抗(kΩ) | |
-50 329.5 | |
-40 188.5 | |
-30 111.3 | |
-20 67.77 | |
-10 42.47 | |
0 27.28 | |
10 17.96 | |
20 12.09 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
// a function to print a one-byte value as a binary number. | |
void printByteAsBin(unsigned char oneByte){ | |
unsigned char binStr[8]; | |
unsigned char mask = 128; // 0b 1000 0000; | |
for(int i=0; i<8; i++){ | |
binStr[i] = (oneByte & mask) ? '1' : '0' ; | |
mask >>= 1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "MicroBit.h" | |
#include "AM2302.h" | |
extern MicroBit uBit; | |
int AM2302::bits2bytes(int *buf, int pos){ | |
int Pos = (8 * pos) - 7; | |
int sute = 0; | |
for(int i=Pos ; i<(Pos+8); i++){ | |
sute |= buf[i] << (Pos+7-i); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from scipy.signal import convolve2d | |
from matplotlib.animation import FuncAnimation | |
class LifeGame: # 引数は左から(2次元排列, (表示領域の幅, 高さ), 更新ミリ秒) | |
def __init__(self, mat, figsize=None, interval=1): | |
self.mat = np.asarray(mat, dtype=np.uint8) | |
self.Rules = np.array([[0,0,0,1,0,0,0,0,0], [0,0,1,1,0,0,0,0,0]], dtype=np.uint8) | |
self.Weight = np.array([[1,1,1], [1,0,1], [1,1,1]], dtype=np.uint8) | |
self.anim = FuncAnimation(plt.figure(figsize=figsize), self.__update, interval=interval) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
import matplotlib.pyplot as plt | |
import numpy as np | |
class IMAGE: | |
def __init__(self, imgPath): | |
self.srcImg = Image.open(imgPath) | |
self.__initialize() |