728x90

 

공홈에서 보고 build.gradle Module , Project 에 넣어줬는데 빌드 시 위와같은 에러가 난다.

 

이전에도 났던게 어렴풋이 기억남...

 

해결은 settings.gradle 의 dependencyResolutionManagement  내부에

maven { url 'https://jitpack.io' }

이 줄을 추가해주면 된다.

 

 

나도 또 찾아보기 귀찮아서 포스팅해두기...

사실 가끔 포스팅해놓고 잊어먹고 구글링 또하는데 저번에 그러다가 내 블로그 글이 떠서 실소함...ㅋㅋㅋㅋㅋㅋ

 

출처 :https://github.com/PhilJay/MPAndroidChart/issues/5181#issuecomment-909865975

728x90
728x90

프로젝트를 위해 로드셀 센서를 샀는데 

또 하나의 과정이남았다...  캘리브레이션... 영점잡기..? 

 

Example code 에 있는 HX711_full_example 을 돌려보니 뭔 값만 나오고 어쩌란건가 싶었다

코드를 보니 깃허브 링크가 있다 

 

과정은 다음과 같다.

 

1. set_scale()을 parameter 없이 호출한다. 

    쓰여있는 코드에서 set_scale을 찾아 내용을 비워준다.....

2. tare() 을 호출한다.

3. 무게를 알고있는 물체를 올리고 get_units(10) 호출

4. (내가 올린 무게) / 3번의 결과값  을 해준다. 

이 결과를 set_scale() 인수로 넘긴다.

5. 알맞은 값이 나올 때까지 4번의 결과를 계속조정한다. 

 

예제코드에 set_scale 도 get_unit() 호출도 다 되어있으니 그냥 파라미터 값을 수정하면서 계속 컴파일하고 실행시키면 된다. 

 

아래는 샘플코드

 

/**
 *
 * HX711 library for Arduino - example file
 * https://github.com/bogde/HX711
 *
 * MIT License
 * (c) 2018 Bogdan Necula
 *
**/
#include "HX711.h"


// HX711 circuit wiring
const int LOADCELL_DOUT_PIN = 4;
const int LOADCELL_SCK_PIN = 0;


HX711 scale;

void setup() {
  Serial.begin(38400);
  Serial.println("HX711 Demo");

  Serial.println("Initializing the scale");

  // Initialize library with data output pin, clock input pin and gain factor.
  // Channel selection is made by passing the appropriate gain:
  // - With a gain factor of 64 or 128, channel A is selected
  // - With a gain factor of 32, channel B is selected
  // By omitting the gain factor parameter, the library
  // default "128" (Channel A) is used here.
  scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);

  Serial.println("Before setting up the scale:");
  Serial.print("read: \t\t");
  Serial.println(scale.read());			// print a raw reading from the ADC

  Serial.print("read average: \t\t");
  Serial.println(scale.read_average(20));  	// print the average of 20 readings from the ADC

  Serial.print("get value: \t\t");
  Serial.println(scale.get_value(5));		// print the average of 5 readings from the ADC minus the tare weight (not set yet)

  Serial.print("get units: \t\t");
  Serial.println(scale.get_units(5), 1);	// print the average of 5 readings from the ADC minus tare weight (not set) divided
						// by the SCALE parameter (not set yet)

  scale.set_scale(2280.f);                      // this value is obtained by calibrating the scale with known weights; see the README for details
  scale.tare();				        // reset the scale to 0

  Serial.println("After setting up the scale:");

  Serial.print("read: \t\t");
  Serial.println(scale.read());                 // print a raw reading from the ADC

  Serial.print("read average: \t\t");
  Serial.println(scale.read_average(20));       // print the average of 20 readings from the ADC

  Serial.print("get value: \t\t");
  Serial.println(scale.get_value(5));		// print the average of 5 readings from the ADC minus the tare weight, set with tare()

  Serial.print("get units: \t\t");
  Serial.println(scale.get_units(5), 1);        // print the average of 5 readings from the ADC minus tare weight, divided
						// by the SCALE parameter set with set_scale

  Serial.println("Readings:");
}

void loop() {
  Serial.print("one reading:\t");
  Serial.print(scale.get_units(), 1);
  Serial.print("\t| average:\t");
  Serial.println(scale.get_units(10), 1);

  scale.power_down();			        // put the ADC in sleep mode
  delay(5000);
  scale.power_up();
}

 

위 샘플코드가 들어있는 라이브러리 링크

https://www.arduino.cc/reference/en/libraries/hx711-arduino-library/

 

HX711 Arduino Library - Arduino Reference

Reference > Libraries > Hx711 arduino library HX711 Arduino Library Sensors Library to interface the Avia Semiconductor HX711 ADC. An Arduino library to interface the Avia Semiconductor HX711 24-Bit Analog-to-Digital Converter (ADC) for reading load cells

www.arduino.cc

 

캘리브레이션 설명이 있는 깃허브 링크

 

 

https://github.com/bogde/HX711#how-to-calibrate-your-load-cell

 

GitHub - bogde/HX711: An Arduino library to interface the Avia Semiconductor HX711 24-Bit Analog-to-Digital Converter (ADC) for

An Arduino library to interface the Avia Semiconductor HX711 24-Bit Analog-to-Digital Converter (ADC) for Weight Scales. - GitHub - bogde/HX711: An Arduino library to interface the Avia Semiconduct...

github.com

 

 

728x90
728x90

맨땅에 헤딩으로 해보는 아두이노

고장난 와이파이모듈때매 헤메고나서 정식으로(?) 부품 주문할때는 와이파이가 포함 된 보드를 구입했다 

 

그러고 로드셀 무게센서를 연결하려는데.....

회로도에는 D2에 연결했는데... 내 보드는...D2가 안보인다..??

일반적인 우노보드모양대로 생겼는데...써있는게 다르다...... 

아두이노를 처음 만져봐서 몹시당황스러웠당 

 

메카솔루션 오픈랩에서 본 회로도..

 

내가 구입한 보드,,

 

근데 1. 어떤핀이 D2와 같은..? 핀인지

2. 그럼 IN_PIN 상수값은 뭘로 해줘야하는지... 두가지에서 멈추었다. 

 

결론은 어떤핀이 어떤역할을 하는지 핀맵에 나와있지만 해석이 안되는 나는....판매 페이지에서 요 표를 참고해서 

샘플회로가 D2에 연결되어있으면 > GPIO4, D3에 연결되어있으면 > GPIO0 에 연결했고

상수값은 각각 4와 0 을 넣어주니 잘 작동했다. 

 

아두이노 다루는 분들이 보면 이게 뭔가 싶겠지만.... 

암튼 나는 여기저기 찾아보고 꽤 힘들게 해결했어서, 또 이 보드를 한동안 가지고 씨름해야할거같아서 정리해봄 

 

 

참고한 회로도는 

https://blog.naver.com/roboholic84/220441853297 

 

[아두이노 강좌] 아두이노 로드셀(Load Cell), 무게측정 센서, 계측 앰프 사용하기 (Sparkfun Load Cell Amp

[아두이노 강좌. 아두이노 로드셀 센서, 앰프 사용하여 무게 측정하기] 마이크로 컨트롤러(아두이노) , 로...

blog.naver.com

상품페이지는 

https://mechasolution.com/shop/goods/goods_view.php?&goodsno=330578 

 

전자부품 전문 쇼핑몰 메카솔루션입니다.

국내 최대 전자부품 쇼핑몰, 아두이노 키트, 라즈베리파이 등 당일발송, 예제 제공, 쇼핑 그 이상을 제공합니다.

mechasolution.com

물론 구매도 여기서했다.. 

 

 

728x90
728x90

안드로이드 코드랩을 참고해 데이터바인딩 + 리사이클러뷰+코루틴을 구현중이다.

 

데이터 바인딩 따로, 리사이클러뷰 따로는 찾아보면 쉽게 나와있는데 섞어서 하려니 한참 해메이다가 결국 코드랩 다시하고 코드랩 코드 보면서 하는중..

 

근데 코드랩 코드에도 빨간줄이 쫘아악 가있는 부분이있다

 

실행은 되는데 해당 코드에서 뜨는 에러는

Unresolved reference: SleepTrackerFragmentDirection 

위와 같다.

 

찾아보니 safeArgs 라는 자동으로 탐색용 객체를 만들어주는 플러그인이 있는데 이걸 포함안해서 나는 오류인듯하다.

 

해결방법은 해당 플러그인 활성화이다.

 

 

1. 최상위 Gradle(Project) 맨 위에 아래 코드 추가

buildscript {
    repositories {
        google()
    }
    dependencies {
        classpath("androidx.navigation:navigation-safe-args-gradle-plugin:2.4.2")
    }
}

 

 

2. Gradle(Module) plugins 에 아래 코드 추가

id("androidx.navigation.safeargs")

 

3. Sync

 

Trouble shooting :

뭔가 잘 안된다싶으면 해당 action 을 navigation 에서 지웠다가 다시 생성해보기

Build > Rebuild 해보기

gradle.properties 에서

android.useAndroidX=true

인지 확인해보기

 

 

 

 

출처 :

더보기

https://developer.android.com/guide/navigation/navigation-navigate?hl=ko#kts

728x90

+ Recent posts