Ahmet
S38>S85
- Katılım
- 31 Mayıs 2021
- Mesajlar
- 6,167
Analog ortlama alacağın bir program yaz dedim.
		Kod:
	
	const int numSamples = 10;  // Number of samples to average
int samples[numSamples];    // Array to hold the samples
int sum = 0;                // Sum of the samples
int average = 0;            // Average of the samples
void loop() {
  // Read the input from the sensor
  int input = analogRead(A0);
  // Add the new sample to the sum and remove the oldest sample
  sum = sum - samples[0] + input;
  // Shift the samples in the array
  for (int i = 0; i < numSamples - 1; i++) {
    samples[i] = samples[i + 1];
  }
  // Add the new sample to the end of the array
  samples[numSamples - 1] = input;
  // Calculate the average
  average = sum / numSamples;
  // Use the average value for further processing or display
  ...
}7 segment sürücü yaz dedim
		Kod:
	
	const int dataPin = 8;
const int latchPin = 12;
const int clockPin = 11;
const int digitPins[8] = {2, 3, 4, 5, 6, 7, 8, 9};
void setup() {
  // Set the pin modes for the shift register and the display
  pinMode(dataPin, OUTPUT);
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  for (int i = 0; i < 8; i++) {
    pinMode(digitPins[i], OUTPUT);
  }
}
void loop() {
  // Send the data to the shift register
  shiftOut(dataPin, clockPin, MSBFIRST, 0b11111100);
  // Latch the data to the display
  digitalWrite(latchPin, HIGH);
  digitalWrite(latchPin, LOW);
  // Turn on the first digit
  digitalWrite(digitPins[0], HIGH);
  // Wait for a specified time
  delay(1);
  // Turn off the first digit
  digitalWrite(digitPins[0], LOW);
  // Repeat for the other digits
}OLED EKRAN KULLAN DEDİM
		Kod:
	
	#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// Define the OLED display and the pins for the parallel interface
Adafruit_SSD1306 display(128, 64, OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
void setup() {
  // Initialize the OLED display
  display.begin(SSD1306_SWITCHCAPVCC);
  // Clear the display
  display.clearDisplay();
  // Set the text size and color
  display.setTextSize(1);
  display.setTextColor(WHITE);
}
void loop() {
  // Draw a line on the display
  display.drawLine(0, 0, 127, 63, WHITE);
  // Draw some text on the display
  display.setCursor(0, 0);
  display.println("Hello, World!");
  // Update the display
  display.display();
  // Wait for a specified time
  delay(1000);
}Eğer alogirtmayı kilitleyeceğini düşündüğünüz sorular varsa söyleyin soralım,
@taydin ve @ozkarah ne soralım da kilitlensin bu chatGPT.
 
	 
 
		 
 
		 
  
 
		

 
 
		

 
 
		 
 
		 
 
		
 
 
		 
 
		 
 
		